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
All checks were successful
build-and-push-ext / build_push (push) Successful in 4m41s
This commit is contained in:
parent
a87bca5042
commit
a3793512c2
18
middleware.ts
Normal file
18
middleware.ts
Normal 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'],
|
||||
};
|
||||
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user