a 403 may be returned if the user has been deleted but the session still exists, redirect to welcome page

This commit is contained in:
Athou
2023-06-05 18:46:32 +02:00
parent 6b9f8f268f
commit 9b757735b8

View File

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