mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-18 20:09:25 +00:00
21 lines
No EOL
714 B
TypeScript
21 lines
No EOL
714 B
TypeScript
'use client';
|
|
|
|
import { OrgProvider } from '@components/Contexts/OrgContext'
|
|
import ErrorUI from '@components/Objects/StyledElements/Error/Error'
|
|
import { useSearchParams } from 'next/navigation'
|
|
import React from 'react'
|
|
|
|
export default function AuthLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
const searchParams = useSearchParams()
|
|
// Use optional chaining and nullish coalescing for type safety
|
|
const orgslug = searchParams?.get('orgslug') ?? null
|
|
if (orgslug) {
|
|
return <OrgProvider orgslug={orgslug}>{children}</OrgProvider>
|
|
} else {
|
|
return <ErrorUI message='Organization not specified' submessage='Please access this page from an Organization' />
|
|
}
|
|
} |