Function
request
(url: string, options?: any)
Source from the content-addressed store, hash-verified
| 45 | } |
| 46 | |
| 47 | function request(url: string, options?: any) { |
| 48 | return fetch(url, { |
| 49 | headers: { |
| 50 | 'Content-Type': 'application/json', |
| 51 | }, |
| 52 | credentials: 'include', |
| 53 | ...options, |
| 54 | }) |
| 55 | .then(jsonInterceptor) |
| 56 | .then(errorInterceptor) |
| 57 | .catch((err: any) => Promise.reject(err)); |
| 58 | } |
| 59 | |
| 60 | export function get(url: string, data?: any) { |
| 61 | return request(`${url}${isEmpty(data) ? '' : `?${qs.stringify(data)}`}`, { |
Tested by
no test coverage detected