32 lines
925 B
TypeScript
32 lines
925 B
TypeScript
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>
|
|
);
|
|
} |