mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 12:07:09 +00:00
WA-521 Improved enhancedFetch returning error and data in a promise
This commit is contained in:
parent
03d632b755
commit
1518521dba
@ -12,8 +12,8 @@ export const enhancedFetch = async (url: string, errMsg: string) => {
|
||||
|
||||
const response = await fetch(url, sentData)
|
||||
if (!response.ok) {
|
||||
throw new Error(errMsg)
|
||||
return Promise.reject(new Error(errMsg))
|
||||
}
|
||||
|
||||
return response.json()
|
||||
return Promise.resolve(response.json())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user