Skip to content

Commit

Permalink
fix: key
Browse files Browse the repository at this point in the history
  • Loading branch information
amjed-ali-k committed Oct 14, 2023
1 parent e209d0d commit 7038665
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@

body {
min-height: 100vh;
min-height: fill-available;
min-height: stretch;
min-height: -webkit-fill-available;
}
html {
height: fill-available;
height: stretch;
height: -webkit-fill-available;
}

Expand Down
28 changes: 14 additions & 14 deletions src/components/auth/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ export const fetchUserId = async (hanko: string) => {
};

export const getUserId = async (req: NextRequest) => {
const userId = req.headers.get("x-user-id");
return userId;
// const hanko = req.cookies.get("hanko")?.value ?? "";
// if (!hanko) {
// throw new Error("No Hanko cookie found");
// }
// const userId = await fetchUserId(hanko);
// // validate userId is uuid using zod
// const schema = z.string().uuid();
// const validatedUserId = schema.safeParse(userId);
// if (!validatedUserId.success) {
// throw new Error("Invalid user id");
// }
// return validatedUserId.data;
// const userId = req.headers.get("x-user-id");
// return userId;
const hanko = req.cookies.get("hanko")?.value ?? "";
if (!hanko) {
return null;
}
const userId = await fetchUserId(hanko);
// validate userId is uuid using zod
const schema = z.string().uuid();
const validatedUserId = schema.safeParse(userId);
if (!validatedUserId.success) {
throw new Error("Invalid user id");
}
return validatedUserId.data;
};

0 comments on commit 7038665

Please sign in to comment.