mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Filter non-JSON payload
This commit is contained in:
@ -67,3 +67,11 @@ export function APIReducer(state, action) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
export function getErrorMessage(error) {
|
||||
let payload = "An unknown error occurred";
|
||||
if (error.response.headers["content-type"] === "application/json") {
|
||||
payload = error.response.data;
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
Reference in New Issue
Block a user