feat(WEB-209): revalidate my pages navigation on demand
This commit is contained in:
committed by
Michael Zetterberg
parent
16634abbbf
commit
1bffbc837e
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user