Skip to content

Commit

Permalink
fix: authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
henzyd committed Oct 30, 2024
1 parent 9bd0b28 commit 5534cc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/api/utils/decode/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
2 changes: 1 addition & 1 deletion src/middlewares/api/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down

0 comments on commit 5534cc2

Please sign in to comment.