Lint
This commit is contained in:
parent
482189896e
commit
1929208af6
4 changed files with 3 additions and 9 deletions
|
@ -6,7 +6,6 @@ export default authMiddleware({
|
|||
publicRoutes: ["/", "/api/public/(.*)"],
|
||||
afterAuth: async (auth, req) => {
|
||||
if (!auth.userId && auth.isPublicRoute) {
|
||||
console.log("1");
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
|
@ -14,9 +13,7 @@ export default authMiddleware({
|
|||
req.nextUrl.pathname.includes("/api/webhooks") ||
|
||||
req.nextUrl.pathname.includes("/api/private")
|
||||
) {
|
||||
console.log("2");
|
||||
const isValid = await validateRequest(req);
|
||||
console.log("Is Valid?: ", isValid);
|
||||
if (isValid) {
|
||||
return NextResponse.next();
|
||||
} else {
|
||||
|
@ -24,9 +21,7 @@ export default authMiddleware({
|
|||
}
|
||||
}
|
||||
if (!auth.userId && !auth.isPublicRoute) {
|
||||
console.log(req.nextUrl);
|
||||
console.log("3");
|
||||
return redirectToSignIn({ returnBackUrl: req.url });
|
||||
redirectToSignIn({ returnBackUrl: req.url });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ export const config = {
|
|||
regions: ["pdx1"],
|
||||
};
|
||||
|
||||
export default async function handler() {
|
||||
export default function handler() {
|
||||
return NextResponse.json(
|
||||
{ message: "Private Pong!" },
|
||||
{ status: 200, statusText: "SUCCESS" }
|
||||
|
|
|
@ -5,7 +5,7 @@ export const config = {
|
|||
regions: ["pdx1"],
|
||||
};
|
||||
|
||||
export default async function handler() {
|
||||
export default function handler() {
|
||||
return NextResponse.json(
|
||||
{ message: "Public Pong!" },
|
||||
{ status: 200, statusText: "SUCCESS" }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { validateRequest } from "~/server/unkey";
|
||||
import {
|
||||
onUserCreatedHandler,
|
||||
onUserDeletedHandler,
|
||||
|
|
Loading…
Add table
Reference in a new issue