diff --git a/src/app/api/utils/decode/route.ts b/src/app/api/utils/decode/route.ts index 329f2f8..8da6054 100644 --- a/src/app/api/utils/decode/route.ts +++ b/src/app/api/utils/decode/route.ts @@ -4,11 +4,14 @@ import catchAsync from "~/utils/catch-async"; export const POST = catchAsync(async (req: NextRequest) => { const { session } = await req.json(); + console.log(session, "/utils.decode"); const data = await decode({ secret: process.env.NEXTAUTH_SECRET!, token: session, }); + console.log(data, "data"); + return NextResponse.json({ user_id: data?.id }); }); diff --git a/src/middlewares/api/authorization.ts b/src/middlewares/api/authorization.ts index 5ac52ac..89ebda3 100644 --- a/src/middlewares/api/authorization.ts +++ b/src/middlewares/api/authorization.ts @@ -17,7 +17,7 @@ export const authorization: MiddlewareFactory = (next) => { const { data: { user_id }, - } = await axiosInstance.post("/utils/decode", { + } = await axiosInstance.post("/api/utils/decode", { session, });