wip
This commit is contained in:
32
apps/website/app/onboarding/page.tsx
Normal file
32
apps/website/app/onboarding/page.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { getAuthService } from '@/lib/auth';
|
||||
import { getDriverRepository } from '@/lib/di-container';
|
||||
import OnboardingWizard from '@/components/onboarding/OnboardingWizard';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function OnboardingPage() {
|
||||
const authService = getAuthService();
|
||||
const session = await authService.getCurrentSession();
|
||||
|
||||
if (!session) {
|
||||
redirect('/auth/iracing?returnTo=/onboarding');
|
||||
}
|
||||
|
||||
// Check if user already has a driver profile
|
||||
const driverRepository = getDriverRepository();
|
||||
const primaryDriverId = session.user.primaryDriverId ?? '';
|
||||
|
||||
if (primaryDriverId) {
|
||||
const existingDriver = await driverRepository.findById(primaryDriverId);
|
||||
if (existingDriver) {
|
||||
redirect('/dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="min-h-screen bg-deep-graphite">
|
||||
<OnboardingWizard />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user