()
| 15 | >; |
| 16 | |
| 17 | export const useAuthenticated = (): AuthenticatedAuthContextValue => { |
| 18 | const auth = useAuthContext(); |
| 19 | |
| 20 | if (!auth.user) { |
| 21 | throw new Error("User is not authenticated."); |
| 22 | } |
| 23 | |
| 24 | if (!auth.permissions) { |
| 25 | throw new Error("Permissions are not available."); |
| 26 | } |
| 27 | |
| 28 | return auth as AuthenticatedAuthContextValue; |
| 29 | }; |
no test coverage detected