From 5b62d4ff3fd5ad413471b6fe5addb5086dad243e Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 11 Feb 2024 19:27:18 +0100 Subject: [PATCH] handle logout --- src/utils.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 0d3a2b8..aa22dc6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -258,7 +258,14 @@ export function myFetch({ }) .catch((error) => { // ignore errors here as they are handled in the components - if (error === 400 || error === 401) throw error; + if (error === 400) throw error; + + if (error === 401) { + handleLogout({ + setUserSession: setUserSessionToLocalStorage, + }); + return; + } // show error notification for all other errors