diff --git a/src/app/globals.css b/src/app/globals.css index 4fea897..9b519a9 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -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; } diff --git a/src/components/auth/server.ts b/src/components/auth/server.ts index 3dff00a..2b4ad05 100644 --- a/src/components/auth/server.ts +++ b/src/components/auth/server.ts @@ -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; };