Only userId 1105261382487539712 and 1116631120763437056 can see the scheduling tab. Other users see only assets + mileage modules. - Add userId to frontend AuthState.user type - App.tsx conditionally includes scheduling module based on user ID - Backend already returns userId in auth exchange response Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
20 lines
450 B
TypeScript
20 lines
450 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
export interface AuthState {
|
|
isLoading: boolean;
|
|
isAuthenticated: boolean;
|
|
user: { userId: string; userName: string; permissionLevel: string; depName: string } | null;
|
|
error: string | null;
|
|
}
|
|
|
|
export const AuthContext = createContext<AuthState>({
|
|
isLoading: true,
|
|
isAuthenticated: false,
|
|
user: null,
|
|
error: null,
|
|
});
|
|
|
|
export function useAuth() {
|
|
return useContext(AuthContext);
|
|
}
|