-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathlayout.js
32 lines (26 loc) · 1.01 KB
/
layout.js
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
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs';
import { cookies } from 'next/headers';
import AuthProvider from 'src/components/AuthProvider';
import 'src/styles/globals.css';
// do not cache this layout
export const revalidate = 0;
export default async function RootLayout({ children }) {
const supabase = createServerComponentClient({ cookies });
const {
data: { session },
} = await supabase.auth.getSession();
return (
<html lang="en">
<body>
<div className="flex min-h-screen flex-col items-center justify-center py-2">
<main className="flex w-full flex-1 shrink-0 flex-col items-center justify-center px-8 text-center sm:px-20">
<h1 className="mb-12 text-5xl font-bold sm:text-6xl">
Next.js with <span className="font-black text-green-400">Supabase</span>
</h1>
<AuthProvider accessToken={session?.access_token}>{children}</AuthProvider>
</main>
</div>
</body>
</html>
);
}