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