|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
300 bytes
|
| Line | |
|---|
| 1 | function responseJson(response) {
|
|---|
| 2 | if (!response.ok) throw new Error(response.status + " " + response.statusText);
|
|---|
| 3 | if (response.status === 204 || response.status === 205) return;
|
|---|
| 4 | return response.json();
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | export default function(input, init) {
|
|---|
| 8 | return fetch(input, init).then(responseJson);
|
|---|
| 9 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.