Refactored to use app folder.

This commit is contained in:
Mike Cao 2023-09-29 05:29:22 -07:00
parent 40cfcd41e9
commit 9a52cdd2e1
258 changed files with 2025 additions and 2258 deletions

View file

@ -1,5 +1,4 @@
import { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
import { httpGet } from 'next-basics';
import enUS from 'public/intl/language/en-US.json';
@ -9,10 +8,9 @@ const languageNames = {
export function useLanguageNames(locale) {
const [list, setList] = useState(languageNames[locale] || enUS);
const { basePath } = useRouter();
async function loadData(locale) {
const { data } = await httpGet(`${basePath}/intl/language/${locale}.json`);
const { data } = await httpGet(`${process.env.basePath}/intl/language/${locale}.json`);
if (data) {
languageNames[locale] = data;