Refactored useConfig.

This commit is contained in:
Mike Cao 2023-08-27 19:56:44 -07:00
parent cc574e6da4
commit 183dab3ddc
11 changed files with 27 additions and 39 deletions

View file

@ -6,7 +6,6 @@ import Script from 'next/script';
import { useRouter } from 'next/router';
import ErrorBoundary from 'components/common/ErrorBoundary';
import useLocale from 'components/hooks/useLocale';
import useConfig from 'components/hooks/useConfig';
import '@fontsource/inter/400.css';
import '@fontsource/inter/700.css';
import 'react-basics/dist/styles.css';
@ -27,22 +26,10 @@ const client = new QueryClient({
export default function App({ Component, pageProps }) {
const { locale, messages } = useLocale();
const { basePath, pathname } = useRouter();
const config = useConfig();
const Wrapper = ({ children }) => <span className={locale}>{children}</span>;
if (config?.uiDisabled) {
return null;
}
return (
<QueryClientProvider client={client}>
<IntlProvider
locale={locale}
messages={messages[locale]}
textComponent={Wrapper}
onError={() => null}
>
<IntlProvider locale={locale} messages={messages[locale]} onError={() => null}>
<ReactBasicsProvider>
<ErrorBoundary>
<Head>