Skip to content

Commit 7ab37e4

Browse files
committed
Fix type things.
1 parent 12a76f7 commit 7ab37e4

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/app/pages/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Header({
5656

5757
export function Layout({ children }: { children: React.ReactNode }) {
5858
const user = requestInfo.ctx?.user;
59-
const theme = requestInfo.ctx?.theme || "system";
59+
const theme = requestInfo.ctx?.theme;
6060

6161
return (
6262
<div className="min-h-screen bg-background">

src/app/pages/user/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export async function finishPasskeyLogin(login: AuthenticationResponseJSON) {
163163
requireUserVerification: false,
164164
credential: {
165165
id: credential.credentialId,
166-
publicKey: credential.publicKey,
166+
publicKey: new Uint8Array(credential.publicKey),
167167
counter: credential.counter,
168168
},
169169
});

src/worker.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type AppContext = {
2626
id: string;
2727
email: string;
2828
} | null;
29-
theme?: "dark" | "light" | "system";
29+
theme: "dark" | "light" | "system";
3030
};
3131

3232
export const getUser = async (session: Session | null) => {
@@ -52,7 +52,13 @@ const app = defineApp([
5252
const themeMatch = cookieHeader?.match(
5353
/(?:^|;)\s*theme=(dark|light|system)(?:;|$)/
5454
);
55-
ctx.theme = (themeMatch?.[1] as "dark" | "light" | "system") || "system";
55+
ctx.theme = "system";
56+
if (
57+
themeMatch?.[1] &&
58+
["dark", "light", "system"].includes(themeMatch[1])
59+
) {
60+
ctx.theme = themeMatch[1] as "dark" | "light" | "system";
61+
}
5662

5763
try {
5864
ctx.session = await sessionStore.load(request);

0 commit comments

Comments
 (0)