This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.main { | ||
min-height: 100vh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client"; | ||
|
||
import { useI18n } from "@/i18n/client"; | ||
import styles from "./page.module.css"; | ||
|
||
export default function Home() { | ||
const { t } = useI18n(); | ||
|
||
return ( | ||
<main className={styles.main}> | ||
<div>{t("welcome")}</div> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<div>Maintenance page</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NextMiddleware } from "next/server"; | ||
|
||
/** | ||
* Middleware util types. | ||
*/ | ||
export type MiddlewareFactory = (middleware: NextMiddleware) => NextMiddleware; | ||
|
||
/** | ||
* Edge Config util types. | ||
*/ | ||
export type LiveAppConfig = { | ||
enabled: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NextFetchEvent, NextMiddleware, NextRequest, NextResponse } from "next/server"; | ||
import { MiddlewareFactory } from "@/middleware/utils/types"; | ||
import { getAppConfig } from "@/middleware/utils"; | ||
|
||
export const withMaintenance: MiddlewareFactory = (next: NextMiddleware) => { | ||
return async (request: NextRequest, _next: NextFetchEvent) => { | ||
await next(request, _next); | ||
|
||
const appConfig = await getAppConfig(); | ||
|
||
if (appConfig && !appConfig.enabled) { | ||
request.nextUrl.pathname = `/maintenance`; | ||
|
||
return NextResponse.rewrite(request.nextUrl); | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters