You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/website/components/conditional-auth-provider/index.jsx

20 lines
549 B

import AuthIndicator from 'components/auth-indicator'
import AuthGate from 'components/auth-gate'
import { Provider as NextAuthProvider } from 'next-auth/client'
const shouldApplyAuth =
process.env.HASHI_ENV === 'production' || process.env.HASHI_ENV === 'preview'
export default function ConditionalAuthProvider({ children, session }) {
return shouldApplyAuth ? (
<NextAuthProvider session={session}>
<AuthGate>
{children}
<AuthIndicator />
</AuthGate>
</NextAuthProvider>
) : (
<>{children}</>
)
}