mirror of
https://gitlab.com/RemixDev/deemix-webui.git
synced 2024-12-28 18:36:30 +00:00
fix: removed blocking fetch responses if not ok
This commit is contained in:
parent
6dc73ac69e
commit
f13f643baa
|
@ -6,14 +6,10 @@ export function fetchData(key, data = {}, method = 'GET') {
|
||||||
})
|
})
|
||||||
|
|
||||||
return fetch(url.href, { method })
|
return fetch(url.href, { method })
|
||||||
.then(response => {
|
.then(response => response.json())
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Network response was not ok')
|
|
||||||
}
|
|
||||||
return response.json()
|
|
||||||
})
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('There has been a problem with your fetch operation:', error)
|
console.error('There has been a problem with your fetch operation:', error)
|
||||||
|
return Promise.reject(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue