(response)
| 1 | import fetch from 'dva/fetch'; |
| 2 | |
| 3 | function checkStatus(response) { |
| 4 | if (response.status >= 200 && response.status < 300) { |
| 5 | return response; |
| 6 | } |
| 7 | |
| 8 | const error = new Error(response.statusText); |
| 9 | error.response = response; |
| 10 | throw error; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Requests a URL, returning a promise. |