fix(next): move middleware to project root to ensure /lecoffre -> /lecoffre/ redirect
All checks were successful
build-and-push-ext / build_push (push) Successful in 4m41s

This commit is contained in:
Debian Dev4 2025-09-24 16:33:18 +00:00
parent a87bca5042
commit a3793512c2
2 changed files with 19 additions and 17 deletions

18
middleware.ts Normal file
View File

@ -0,0 +1,18 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
if (pathname === '/lecoffre') {
const url = request.nextUrl.clone();
url.pathname = '/lecoffre/';
return NextResponse.redirect(url, 308);
}
return NextResponse.next();
}
export const config = {
matcher: ['/lecoffre'],
};

View File

@ -1,20 +1,4 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
if (pathname === '/lecoffre') {
const url = request.nextUrl.clone();
url.pathname = '/lecoffre/';
return NextResponse.redirect(url, 308);
}
return NextResponse.next();
}
export const config = {
matcher: ['/lecoffre'],
};
// moved to project root middleware.ts
import { ICustomerJwtPayload, IUserJwtPayload } from "@Front/Services/JwtService/JwtService";
import jwt_decode from "jwt-decode";
import { NextResponse } from "next/server";