(baseFetch: WindowOrWorkerGlobalScope['fetch'])
| 98 | */ |
| 99 | export const createAuthInjectingFetch = |
| 100 | (baseFetch: WindowOrWorkerGlobalScope['fetch']): WindowOrWorkerGlobalScope['fetch'] => |
| 101 | (input, init) => { |
| 102 | const headers = new Headers(init?.headers); |
| 103 | if (config.jwt && !headers.has('Authorization')) { |
| 104 | headers.set('Authorization', `Bearer ${config.jwt}`); |
| 105 | } |
| 106 | return baseFetch(input, { ...init, headers }); |
| 107 | }; |
| 108 | |
| 109 | /** |
| 110 | * Interceptor to handle license expiration errors in gRPC responses. |
no test coverage detected
searching dependent graphs…