Updated login and layout pages.

This commit is contained in:
Mike Cao 2023-01-11 14:47:38 -08:00
parent 9d967fb0fe
commit 4f15c4f146
18 changed files with 103 additions and 106 deletions

View file

@ -1,11 +1,10 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import { setItem } from 'next-basics';
import { get, setItem } from 'next-basics';
import { LOCALE_CONFIG } from 'lib/constants';
import { getDateLocale, getTextDirection } from 'lib/lang';
import useStore, { setLocale } from 'store/app';
import useForceUpdate from 'hooks/useForceUpdate';
import useApi from 'hooks/useApi';
import enUS from 'public/intl/messages/en-US.json';
const messages = {
@ -20,12 +19,11 @@ export default function useLocale() {
const forceUpdate = useForceUpdate();
const dir = getTextDirection(locale);
const dateLocale = getDateLocale(locale);
const { get } = useApi();
async function loadMessages(locale) {
const data = await get(`${basePath}/intl/messages/${locale}.json`);
const { ok, data } = await get(`${basePath}/intl/messages/${locale}.json`);
if (data) {
if (ok) {
messages[locale] = data;
}
}