useAuth.ts
1 // Copyright (c) 2026 VPL Solutions. All rights reserved. 2 // Licensed under the MIT License. See LICENSE for details. 3 4 import { useContext } from 'react'; 5 import { AuthContext } from './AuthContext'; 6 7 export function useAuth() { 8 const ctx = useContext(AuthContext); 9 if (!ctx) { 10 throw new Error('useAuth must be used within an AuthProvider'); 11 } 12 return ctx; 13 }