mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-12-13 21:02:51 -05:00
move conditional next-auth code to alternate files
This commit is contained in:
@@ -14,25 +14,10 @@ export default async function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
// Only get session if sponsored signer is enabled or seed phrase is provided
|
||||
const sponsorSigner = process.env.SPONSOR_SIGNER === 'true';
|
||||
const hasSeedPhrase = !!process.env.SEED_PHRASE;
|
||||
const shouldUseSession = sponsorSigner || hasSeedPhrase;
|
||||
|
||||
let session = null;
|
||||
if (shouldUseSession) {
|
||||
try {
|
||||
const { getSession } = await import('~/auth');
|
||||
session = await getSession();
|
||||
} catch (error) {
|
||||
console.warn('Failed to get session:', error);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<Providers session={session} shouldUseSession={shouldUseSession}>
|
||||
<Providers>
|
||||
{children}
|
||||
</Providers>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user