fix(dashboard): add maintenance in middleware
This commit is contained in:
@@ -3,13 +3,13 @@ import { CalendarCogIcon } from 'lucide-react';
|
|||||||
export default function Maintenance() {
|
export default function Maintenance() {
|
||||||
return (
|
return (
|
||||||
<div className="h-screen w-full center-center overflow-hidden">
|
<div className="h-screen w-full center-center overflow-hidden">
|
||||||
<div className="relative z-10 col gap-2 center-center">
|
<div className="relative z-10 col gap-2 center-center p-4">
|
||||||
<CalendarCogIcon className="size-32 mb-4 animate-wiggle text-def-300" />
|
<CalendarCogIcon className="size-32 mb-4 animate-wiggle text-def-300" />
|
||||||
<div className="text-[150px] font-mono font-bold -mb-16 leading-[1] select-none pointer-events-none whitespace-nowrap bg-gradient-to-b from-def-300 to-def-100 bg-clip-text text-transparent">
|
<div className="text-[90px] sm:text-[150px] font-mono font-bold -mb-16 leading-[1] select-none pointer-events-none whitespace-nowrap bg-gradient-to-b from-def-300 to-def-100 bg-clip-text text-transparent">
|
||||||
Oh no!
|
Oh no!
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-6xl font-bold">Maintenance</h1>
|
<h1 className="text-5xl sm:text-6xl font-bold">Maintenance</h1>
|
||||||
<p className="text-xl text-muted-foreground">
|
<p className="text-xl text-muted-foreground leading-normal">
|
||||||
We're doing a planned maintenance. Please check back later.
|
We're doing a planned maintenance. Please check back later.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,9 +28,18 @@ const isPublicRoute = createRouteMatcher([
|
|||||||
'/reset-password(.*)?',
|
'/reset-password(.*)?',
|
||||||
'/sso-callback(.*)?',
|
'/sso-callback(.*)?',
|
||||||
'/onboarding',
|
'/onboarding',
|
||||||
|
'/maintenance',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export default (request: NextRequest) => {
|
export default (request: NextRequest) => {
|
||||||
|
// Check for maintenance mode
|
||||||
|
if (
|
||||||
|
process.env.MAINTENANCE === 'true' &&
|
||||||
|
!request.nextUrl.pathname.startsWith('/maintenance')
|
||||||
|
) {
|
||||||
|
return NextResponse.redirect(new URL('/maintenance', request.url));
|
||||||
|
}
|
||||||
|
|
||||||
if (request.method === 'GET') {
|
if (request.method === 'GET') {
|
||||||
const response = NextResponse.next();
|
const response = NextResponse.next();
|
||||||
const token = request.cookies.get('session')?.value ?? null;
|
const token = request.cookies.get('session')?.value ?? null;
|
||||||
|
|||||||
Reference in New Issue
Block a user