WA-521 Improved enhancedFetch returning error and data in a promise

This commit is contained in:
apanizo 2018-08-10 17:37:05 +02:00
parent 03d632b755
commit 1518521dba
1 changed files with 2 additions and 2 deletions

View File

@ -12,8 +12,8 @@ export const enhancedFetch = async (url: string, errMsg: string) => {
const response = await fetch(url, sentData) const response = await fetch(url, sentData)
if (!response.ok) { if (!response.ok) {
throw new Error(errMsg) return Promise.reject(new Error(errMsg))
} }
return response.json() return Promise.resolve(response.json())
} }