()
| 48 | } |
| 49 | |
| 50 | function authToken(): string | null { |
| 51 | if (typeof window === 'undefined') return null; |
| 52 | const fromHash = readTokenParam(window.location.hash); |
| 53 | const fromSearch = readTokenParam(window.location.search); |
| 54 | const token = fromHash ?? fromSearch; |
| 55 | if (token !== null && token.length > 0) { |
| 56 | window.localStorage.setItem(TOKEN_STORAGE_KEY, token); |
| 57 | scrubTokenFromUrl(); |
| 58 | return token; |
| 59 | } |
| 60 | return window.localStorage.getItem(TOKEN_STORAGE_KEY); |
| 61 | } |
| 62 | |
| 63 | async function request<T>(path: string, method: 'GET' | 'POST' | 'DELETE'): Promise<T> { |
| 64 | const headers: Record<string, string> = { accept: 'application/json' }; |
no test coverage detected