From 98f5e503e8b24fbde388b709d79d4972b04d2f26 Mon Sep 17 00:00:00 2001 From: Anishali2 Date: Thu, 30 May 2024 00:56:56 +0500 Subject: [PATCH] Mod1 bug: languages not fetching in auth pages --- apps/web/app/hooks/features/useLanguageSettings.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/web/app/hooks/features/useLanguageSettings.ts b/apps/web/app/hooks/features/useLanguageSettings.ts index 16bad43a6..f5bd7c535 100644 --- a/apps/web/app/hooks/features/useLanguageSettings.ts +++ b/apps/web/app/hooks/features/useLanguageSettings.ts @@ -39,14 +39,10 @@ export function useLanguageSettings() { const loadLanguagesData = useCallback(() => { setActiveLanguageId(getActiveLanguageIdCookie()); - if (user) { - return queryCall(user.role.isSystem).then((res) => { - setLanguages( - res?.data?.items.filter((item: any) => APPLICATION_LANGUAGES_CODE.includes(item.code)) || [] - ); - return res; - }); - } + return queryCall(user?.role?.isSystem ?? false).then((res) => { + setLanguages(res?.data?.items.filter((item: any) => APPLICATION_LANGUAGES_CODE.includes(item.code)) || []); + return res; + }); }, [queryCall, setActiveLanguageId, setLanguages, user]); const setActiveLanguage = useCallback(