diff --git a/src/utils/functions/storage.ts b/src/utils/functions/storage.ts index a95182a..a75a33f 100644 --- a/src/utils/functions/storage.ts +++ b/src/utils/functions/storage.ts @@ -45,7 +45,12 @@ export const setJSON = (name: StorageNames, data: T | null): boolean => { export const getUser = (): UserTokenDto | null => getJSON(StorageNames.user) -export const getUserPermissions = (): Permission[] | null => getUser()?.permissions?.map((perm) => perm.name as string) || null +export const getUserPermissions = (): Permission[] | null => { + let permissions = getUser()?.permissions?.map((perm) => perm.name as string) + if (!permissions) // TODO: Удалить в следующем релизе, вставлено для совместимости + permissions = localStorage.getItem(StorageNames.permissions)?.split(',') + return permissions || null +} export const getUserId = () => Number(localStorage.getItem(StorageNames.userId)) || null export const getUserLogin = () => localStorage.getItem(StorageNames.login) export const getUserToken = () => localStorage.getItem(StorageNames.token)