Skip to content

Commit

Permalink
fix(index.js): Add status=500 context
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-cline committed Jul 23, 2021
1 parent b6b5329 commit 7981da7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/common/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ export function secureFetch (url: string, method: string = 'get', payload?: any,
const {status} = res
if (status >= 500) {
action = 'RELOAD'
message = `Network error!\n\n(${method} request on ${url})`
consoleError(message)
dispatch(setErrorMessage({message, action}))
res.json().then(json => {
const {detail, message} = json
const unknown = `Network error!\n\n(${method} request on ${url})`
consoleError(message || JSON.stringify(json) || unknown)
dispatch(setErrorMessage({
message: message || JSON.stringify(json) || unknown,
action,
detail
}))
})
return null
} else if (status >= 400) {
action = status === 401
Expand Down

0 comments on commit 7981da7

Please sign in to comment.