-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.tsx
42 lines (39 loc) · 1.02 KB
/
layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint-disable @typescript-eslint/no-misused-promises */
import ConvexClientProvider from "@/app/ConvexClientProvider";
import { auth, signOut } from "@/auth";
import { StickyHeader } from "@/components/layout/sticky-header";
import { Button } from "@/components/ui/button";
export default async function LoggedInLayout({
children,
}: {
children: React.ReactNode;
}) {
const session = await auth();
return (
<>
<StickyHeader className="px-4 py-2">
<div className="flex justify-between items-center">
Convex + Next.js + Auth.js
<SignOut />
</div>
</StickyHeader>
<main className="container max-w-2xl flex flex-col gap-8">
<ConvexClientProvider session={session}>
{children}
</ConvexClientProvider>
</main>
</>
);
}
export function SignOut() {
return (
<form
action={async () => {
"use server";
await signOut({ redirectTo: "/" });
}}
>
<Button type="submit">Sign out</Button>
</form>
);
}