From 23556990831b327488065c3697555218b42c92b7 Mon Sep 17 00:00:00 2001 From: alexis-opolka <53085471+alexis-opolka@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:20:48 +0200 Subject: [PATCH] Update the locale routing --- next.config.js | 13 ++++--------- src/app/(portfolio)/errors.tsx | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 src/app/(portfolio)/errors.tsx diff --git a/next.config.js b/next.config.js index 7302e94..c73ea44 100644 --- a/next.config.js +++ b/next.config.js @@ -6,10 +6,10 @@ const nextConfig = { ignoreBuildErrors: true, }, experimental: { - typedRoutes: true, - swcPlugins: [ - ["@lingui/swc-plugin", {}], - ] + // typedRoutes: true, + // swcPlugins: [ + // ["@lingui/swc-plugin", {}], + // ] }, webpack: function (config) { config.module.rules.push({ @@ -18,11 +18,6 @@ const nextConfig = { }); return config; }, - i18n: { - // These are all the locales we want to support - locales: ["en", "fr"], - defaultLocale: "en" - }, output: undefined } diff --git a/src/app/(portfolio)/errors.tsx b/src/app/(portfolio)/errors.tsx new file mode 100644 index 0000000..159b5d7 --- /dev/null +++ b/src/app/(portfolio)/errors.tsx @@ -0,0 +1,34 @@ +"use client" + +import { useRouter } from "next/navigation"; +import { useEffect } from 'react' + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string } + reset: () => void +}) { + const router = useRouter(); + + useEffect(() => { + // Log the error to an error reporting service + console.error(error) + router.push("/"); + }, [error, router]); + + return ( +