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

15
middlewares/ensureLang.ts Normal file
View File

@@ -0,0 +1,15 @@
import { NextResponse } from "next/server"
import { findLang } from "@/constants/languages"
import type { NextMiddleware } from "next/server"
import type { MiddlewareMatcher } from "@/types/middleware"
export const middleware: NextMiddleware = () => {
return new NextResponse("Not found", { status: 404 })
}
export const matcher: MiddlewareMatcher = (request) => {
return !findLang(request.nextUrl.pathname)
}