Skip to content

Commit

Permalink
refactor: http status code constants
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 10, 2024
1 parent 7a2bdd4 commit c553382
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import { client } from "../studio/lib/client";
import { RedirectSparsePage } from "../studio/lib/payloads/redirect";
import { HTTP_STATUSES } from "./utils/http";

export async function middleware(request: NextRequest) {
const slug = request.nextUrl.pathname;
Expand All @@ -12,7 +13,7 @@ export async function middleware(request: NextRequest) {
if (redirect !== null) {
return NextResponse.redirect(
new URL(redirect.destination, request.url),
307,
HTTP_STATUSES.TEMPORARY_REDIRECT,
);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/http.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const HTTP_STATUSES = {
TEMPORARY_REDIRECT: 307,
};

0 comments on commit c553382

Please sign in to comment.