(path: string, options: RequestInit = {})
| 60 | } |
| 61 | |
| 62 | private async fetch<T>(path: string, options: RequestInit = {}): Promise<T> { |
| 63 | const config = this.getConfig() |
| 64 | if (!config) { |
| 65 | throw new Error('Sync service not configured') |
| 66 | } |
| 67 | |
| 68 | // @ts-ignore |
| 69 | const json = await window.api.fetchJSON(`${config.baseUrl}${path}`, { |
| 70 | ...options, |
| 71 | headers: { |
| 72 | ...options.headers, |
| 73 | Authorization: `Bearer ${config.authToken}` |
| 74 | } |
| 75 | }) |
| 76 | |
| 77 | return json |
| 78 | } |
| 79 | |
| 80 | private async get<T>(path: string): Promise<T> { |
| 81 | this.log.debug('GET', path) |
no test coverage detected