wip
This commit is contained in:
20
apps/website/lib/currentDriver.ts
Normal file
20
apps/website/lib/currentDriver.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/lib/auth/AuthContext';
|
||||
|
||||
/**
|
||||
* Returns the effective driver ID for the current session.
|
||||
*
|
||||
* Prefers the authenticated user's primaryDriverId when available,
|
||||
* otherwise falls back to the demo default used across the alpha site.
|
||||
*/
|
||||
export function useEffectiveDriverId(): string {
|
||||
const { session } = useAuth();
|
||||
const user = session?.user as
|
||||
| {
|
||||
primaryDriverId?: string | null;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
return user?.primaryDriverId ?? 'driver-1';
|
||||
}
|
||||
Reference in New Issue
Block a user