init create-fias
This commit is contained in:
13
src/shared/lib/getLocaleCS.ts
Normal file
13
src/shared/lib/getLocaleCS.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { LanguageRoutes } from '../config/i18n/types';
|
||||
|
||||
const getLocaleCS = (): LanguageRoutes | undefined => {
|
||||
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
const match = document.cookie
|
||||
.split('; ')
|
||||
.find((row) => row.startsWith('NEXT_LOCALE='));
|
||||
return match?.split('=')[1] as LanguageRoutes;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export default getLocaleCS;
|
||||
Reference in New Issue
Block a user