diff --git a/src/components/Layout/MainLayout.tsx b/src/components/Layout/MainLayout.tsx index 77d75d71..d776cfd3 100644 --- a/src/components/Layout/MainLayout.tsx +++ b/src/components/Layout/MainLayout.tsx @@ -23,15 +23,19 @@ type SideNavigationItem = { const SideNavigation = () => { const { checkAccess } = useAuthorization(); - const navigation = [ + const navigation: SideNavigationItem[] = [ { name: 'Dashboard', to: '.', icon: HomeIcon }, { name: 'Discussions', to: './discussions', icon: FolderIcon }, - checkAccess({ allowedRoles: [ROLES.ADMIN] }) && { - name: 'Users', - to: './users', - icon: UsersIcon, - }, - ].filter(Boolean) as SideNavigationItem[]; + ...(checkAccess({ allowedRoles: [ROLES.ADMIN] }) + ? [ + { + name: 'Users', + to: './users', + icon: UsersIcon, + }, + ] + : []), + ]; return ( <> @@ -69,7 +73,7 @@ type UserNavigationItem = { const UserNavigation = () => { const { logout } = useAuth(); - const userNavigation = [ + const userNavigation: UserNavigationItem[] = [ { name: 'Your Profile', to: './profile' }, { name: 'Sign out', @@ -78,7 +82,7 @@ const UserNavigation = () => { logout(); }, }, - ].filter(Boolean) as UserNavigationItem[]; + ]; return ( diff --git a/src/config/index.ts b/src/config/index.ts index 973d4f70..99181098 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,2 +1,2 @@ -export const API_URL = process.env.REACT_APP_API_URL as string; -export const JWT_SECRET = '123456' as string; +export const API_URL = process.env.REACT_APP_API_URL; +export const JWT_SECRET = '123456'; diff --git a/src/lib/auth.tsx b/src/lib/auth.tsx index 941ddbad..57636372 100644 --- a/src/lib/auth.tsx +++ b/src/lib/auth.tsx @@ -40,7 +40,7 @@ async function registerFn(data: RegisterCredentialsDTO) { async function logoutFn() { storage.clearToken(); - window.location.assign(window.location.origin as unknown as string); + window.location.assign(window.location.origin); } const authConfig = {