()
| 1 | import { useRouteContext } from '@tanstack/react-router'; |
| 2 | |
| 3 | export function useAppContext() { |
| 4 | const params = useRouteContext({ |
| 5 | strict: false, |
| 6 | }); |
| 7 | |
| 8 | if ( |
| 9 | !(params.apiUrl && params.dashboardUrl) || |
| 10 | typeof params.isSelfHosted === 'undefined' |
| 11 | ) { |
| 12 | throw new Error('API URL or dashboard URL is not set'); |
| 13 | } |
| 14 | |
| 15 | return { |
| 16 | apiUrl: params.apiUrl, |
| 17 | dashboardUrl: params.dashboardUrl, |
| 18 | isSelfHosted: params.isSelfHosted, |
| 19 | isMaintenance: params.isMaintenance ?? false, |
| 20 | isDemo: params.isDemo ?? false, |
| 21 | }; |
| 22 | } |
no outgoing calls
no test coverage detected