mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-14 00:22:02 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
14
pages/_middleware.ts
Normal file
14
pages/_middleware.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { NextMiddleware, NextResponse } from "next/server";
|
||||
import { isInMaintenanceMode } from "../utils/constants";
|
||||
|
||||
export const middleware: NextMiddleware = async (req) => {
|
||||
// redirect user to maintenance page if we're in maintenance mode
|
||||
|
||||
if (isInMaintenanceMode && req.nextUrl.pathname !== "/maintenance") {
|
||||
const url = req.nextUrl.clone();
|
||||
url.pathname = "/maintenance";
|
||||
return NextResponse.redirect(url, 302);
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue