Skip to content

Commit

Permalink
refactor: add locale to locale context provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jonyw4 committed Nov 18, 2021
1 parent 28e1006 commit c6e3b6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webapp/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import type { AppProps } from "next/app";

export default function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();
const { pathname, asPath, query } = router;
const { pathname, asPath, query, locale } = router;

const changeLocale = (nextLocale) => {
router.push({ pathname, query }, asPath, { locale: nextLocale });
};

return (
<LocaleContext.Provider value={{ locale: pageProps.locale, changeLocale }}>
<LocaleContext.Provider value={{ locale: locale, changeLocale }}>
<Component {...pageProps} />
</LocaleContext.Provider>
);
Expand Down

0 comments on commit c6e3b6e

Please sign in to comment.