Cucusenok
fetch внутри цикла?
const Requests = {
post: (url, body) => {
return fetch(${API_ROOT}${url}
, {
method: 'POST',
headers: (generalStore.token !== null ? {Authorization: Bearer ${generalStore.token}
} : {}),
body: body
}).then(response => response.json())
.then(handleErrors)
},
get: (url) => {
return fetch(${API_ROOT}${url}
, {
method: 'GET',
headers: (generalStore.token !== null ? {Authorization: Bearer ${generalStore.token}
} : {})
}).then(response => response.json())
.then(handleErrors)
}
}