(response: Response)
| 6 | } |
| 7 | |
| 8 | function checkStatus(response: Response) { |
| 9 | if ( |
| 10 | (response.status >= 200 && response.status < 300) |
| 11 | || response.status === 400 |
| 12 | || response.status === 403 |
| 13 | ) { |
| 14 | return response; |
| 15 | } |
| 16 | else if (response.status === 401) { |
| 17 | window.location.href = '/login'; |
| 18 | return response; |
| 19 | } |
| 20 | else { |
| 21 | const error: Error = new Error(response.statusText); |
| 22 | throw error; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | type IResponse<T> = { |
| 27 | success: boolean; |
no outgoing calls
no test coverage detected