add useAuth context

This commit is contained in:
tedraykov
2024-06-21 11:50:58 +03:00
parent cc9def4035
commit 19065c1d82
12 changed files with 181 additions and 109 deletions

View File

@@ -1,5 +1,7 @@
import { headers } from 'next/headers';
export const runtime = 'edge';
export default async function AuthorizationPage() {
const headersList = headers();
const access = headersList.get('x-shop-access');

View File

@@ -1,5 +1,6 @@
import { LoginMessage } from 'components/auth/login-message';
export const runtime = 'edge'; //this needs to be here on thie page. I don't know why
export const runtime = 'edge';
export default async function LoginPage() {
return (

View File

@@ -4,6 +4,7 @@ import { GeistSans } from 'geist/font/sans';
import { ensureStartsWith } from 'lib/utils';
import { ReactNode, Suspense } from 'react';
import './globals.css';
import { AuthProvider } from 'contexts/auth-context';
const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL
@@ -36,13 +37,17 @@ export default async function RootLayout({ children }: { children: ReactNode })
return (
<html lang="en" className={GeistSans.variable}>
<body className="bg-white text-black selection:bg-teal-300 dark:bg-neutral-900 dark:text-white dark:selection:bg-pink-500 dark:selection:text-white">
<header>
<Banner />
<Navbar />
</header>
<Suspense>
<main>{children}</main>
</Suspense>
<AuthProvider>
<div>
<header>
<Banner />
<Navbar />
</header>
<Suspense>
<main>{children}</main>
</Suspense>
</div>
</AuthProvider>
</body>
</html>
);