Skip to content

Commit

Permalink
Update the locale routing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-opolka committed Apr 19, 2024
1 parent 29101df commit 2355699
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
13 changes: 4 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
}

Expand Down
34 changes: 34 additions & 0 deletions src/app/(portfolio)/errors.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<h2>Something went wrong!</h2>
<button
onClick={
// Attempt to recover by trying to re-render the segment
() => reset()
}
>
Try again
</button>
</div>
)
}

0 comments on commit 2355699

Please sign in to comment.