From 5536cddf1bbec5bc3151ed7fd2ffd0eff5c347d1 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Tue, 18 Jan 2022 14:56:18 +0200 Subject: [PATCH] handleError fix --- src/api/useApi.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/useApi.js b/src/api/useApi.js index 15eaf68..06ddacd 100644 --- a/src/api/useApi.js +++ b/src/api/useApi.js @@ -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);