handleError fix

master
Tudor Stanciu 2022-01-18 14:56:18 +02:00
parent c4ae08f558
commit 5536cddf1b
1 changed files with 7 additions and 3 deletions

View File

@ -9,13 +9,17 @@ const useApi = () => {
const handleError = err => {
let message;
switch (err.response?.status) {
switch (err?.status) {
case 500:
message = err.response.statusText;
message = `${err.title} ${err.correlationId}`;
break;
case 404:
message = err.message;
break;
default:
message = err.message;
message = `${err.title} ${err.correlationId}`;
}
error(message);