feat(WEB-132): add middlewares, support for seamless login and improve lang based routes

This commit is contained in:
Michael Zetterberg
2024-04-08 16:08:35 +02:00
parent 8ab5325fc3
commit 7093a0b2dd
31 changed files with 493 additions and 188 deletions

View File

@@ -1,12 +1,15 @@
import createJiti from "jiti"
import { pageNames } from "./constants/myPages.js"
const jiti = createJiti(new URL(import.meta.url).pathname)
import { login } from "./constants/routes/handleAuth.js"
import { myPages, profile } from "./constants/routes/myPages.js"
const jiti = createJiti(new URL(import.meta.url).pathname)
jiti("./env/server")
jiti("./env/client")
/** @type {import('next').NextConfig} */
const nextConfig = {
poweredByHeader: false,
eslint: { ignoreDuringBuilds: true },
images: {
remotePatterns: [
@@ -46,11 +49,23 @@ const nextConfig = {
rewrites() {
return {
beforeFiles: [
{ source: `/da/${pageNames.da}`, destination: "/da/my-pages" },
{ source: `/de/${pageNames.de}`, destination: "/de/my-pages" },
{ source: `/fi/${pageNames.fi}`, destination: "/fi/my-pages" },
{ source: `/no/${pageNames.no}`, destination: "/no/my-pages" },
{ source: `/sv/${pageNames.sv}`, destination: "/sv/my-pages" },
{ source: login.da, destination: "/da/login" },
{ source: login.de, destination: "/de/login" },
{ source: login.fi, destination: "/fi/login" },
{ source: login.no, destination: "/no/login" },
{ source: login.sv, destination: "/sv/login" },
{ source: myPages.da, destination: "/da/my-pages" },
{ source: myPages.de, destination: "/de/my-pages" },
{ source: myPages.fi, destination: "/fi/my-pages" },
{ source: myPages.no, destination: "/no/my-pages" },
{ source: myPages.sv, destination: "/sv/my-pages" },
{ source: profile.da, destination: "/da/my-pages/profile" },
{ source: profile.de, destination: "/de/my-pages/profile" },
{ source: profile.fi, destination: "/fi/my-pages/profile" },
{ source: profile.no, destination: "/no/my-pages/profile" },
{ source: profile.sv, destination: "/sv/my-pages/profile" },
],
}
},