1
0
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:
Maciej Lenartowicz
2019-10-01 09:38:18 +00:00
parent 8479518fab
commit 96eed02d32
7 changed files with 17 additions and 13 deletions

View File

@ -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;
}