feat(WEB-209): revalidate my pages navigation on demand

This commit is contained in:
Simon Emanuelsson
2024-04-16 12:42:44 +02:00
committed by Michael Zetterberg
parent 16634abbbf
commit 1bffbc837e
40 changed files with 600 additions and 144 deletions

View File

@@ -1,13 +1,27 @@
import { NextResponse } from "next/server"
export function badRequest() {
return new NextResponse("Bad request", {
export function badRequest(body: unknown | string = "Bad request") {
const resInit = {
status: 400,
})
}
if (typeof body === "string") {
return new NextResponse(body, resInit)
}
return NextResponse.json(body, resInit)
}
export function internalServerError() {
return new NextResponse("Internal Server Error", {
export function internalServerError(
body: unknown | string = "Internal Server Error"
) {
const resInit = {
status: 500,
})
}
if (typeof body === "string") {
return new NextResponse(body, resInit)
}
return NextResponse.json(body, resInit)
}