Completed Change to ReactJS

This commit is contained in:
2024-09-02 14:28:35 +00:00
parent 953edb3d0c
commit 6264778ea0
89 changed files with 4190 additions and 3866 deletions

View File

@ -1,14 +0,0 @@
import { STORE_KEY } from './enum'
import { Helpers } from './helper'
export default class UserHelper {
#user
constructor() {
this.#user = Helpers.decrypt(localStorage.getItem(STORE_KEY))
}
get isAdmin() {
return this.#user?.userInfo?.isAdmin
}
}

View File

@ -1,5 +1,11 @@
// const PRODUCTION = import.meta.env.NODE_ENV === 'production'
export const SECRET_KEY = 'bGV0IGRvIGl0IGZvciBlbmNyeXRo'
export const STORE_KEY = 'dXNlciBsb2dpbiBpbmZv'
export const LOGIN_KEY = '7fo24CMyIc'
export const VIEWDATA = Object.freeze(
new Proxy(
{ list: 'list', grid: 'grid' },
{
get: (target, prop) => target[prop] ?? 'list',
},
),
)

View File

@ -1,4 +1,3 @@
import { ROUTES } from '@routes/routes'
import { AES, enc } from 'crypto-js'
import { LOGIN_KEY, SECRET_KEY, STORE_KEY } from './enum'
@ -51,7 +50,11 @@ export class Helpers {
static clearObject = (object) => {
for (var propName in object) {
if (object[propName] === null || object[propName] === undefined) {
if (
object[propName] === null ||
object[propName] === undefined ||
object[propName] === ''
) {
delete object[propName]
}
}
@ -70,7 +73,4 @@ export class Helpers {
return array.length > 0 ? array : null
}
static getRoutePath = (pathName) =>
ROUTES.filter((r) => r.name === pathName)[0].path
}