From 9b757735b8d19fcb6636b3b3f5963772d676a398 Mon Sep 17 00:00:00 2001 From: Athou Date: Mon, 5 Jun 2023 18:46:32 +0200 Subject: [PATCH] a 403 may be returned if the user has been deleted but the session still exists, redirect to welcome page --- commafeed-client/src/app/client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commafeed-client/src/app/client.ts b/commafeed-client/src/app/client.ts index 6f0f94e6..99d6a26e 100644 --- a/commafeed-client/src/app/client.ts +++ b/commafeed-client/src/app/client.ts @@ -30,7 +30,10 @@ const axiosInstance = axios.create({ baseURL: "./rest", withCredentials: true }) axiosInstance.interceptors.response.use( response => response, error => { - if (error.response.status === 401 && error.response.data === "Credentials are required to access this resource.") { + if ( + (error.response.status === 401 && error.response.data === "Credentials are required to access this resource.") || + (error.response.status === 403 && error.response.data === "You don't have the required role to access this resource.") + ) { window.location.hash = "/welcome" } throw error