From b2c74173b5240a4cfe1a9b44de2e23fc9021d38d Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 9 Apr 2025 17:45:27 -0300 Subject: [PATCH] Fix: Prevent Error Popups When Session Expires During Logout (#7455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 (use-get-refresh-flows-query.ts, use-get-refresh-flows.ts): Add check for AxiosError status to handle specific error case and set error message accordingly. --- .../API/queries/flows/use-get-refresh-flows-query.ts | 9 ++++++--- .../API/queries/flows/use-get-refresh-flows.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows-query.ts b/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows-query.ts index 604172569..b01bf8df3 100644 --- a/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows-query.ts +++ b/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows-query.ts @@ -9,6 +9,7 @@ import { processFlows, } from "@/utils/reactflowUtils"; import { UseQueryOptions } from "@tanstack/react-query"; +import { AxiosError } from "axios"; import { api } from "../../api"; import { getURL } from "../../helpers/constants"; import { UseRequestProcessor } from "../../services/request-processor"; @@ -74,9 +75,11 @@ export const useGetRefreshFlowsQuery: useQueryFunctionType< return []; } catch (e) { - setErrorData({ - title: "Could not load flows from database", - }); + if (e instanceof AxiosError && e.status !== 403) { + setErrorData({ + title: "Could not load flows from database", + }); + } throw e; } }; diff --git a/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows.ts b/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows.ts index 37208bf7c..ca65bcb5e 100644 --- a/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows.ts +++ b/src/frontend/src/controllers/API/queries/flows/use-get-refresh-flows.ts @@ -9,6 +9,7 @@ import { processFlows, } from "@/utils/reactflowUtils"; import { UseMutationOptions } from "@tanstack/react-query"; +import { AxiosError } from "axios"; import { api } from "../../api"; import { getURL } from "../../helpers/constants"; import { UseRequestProcessor } from "../../services/request-processor"; @@ -77,9 +78,11 @@ export const useGetRefreshFlows: useMutationFunctionType< return []; } catch (e) { - setErrorData({ - title: "Could not load flows from database", - }); + if (e instanceof AxiosError && e.status !== 403) { + setErrorData({ + title: "Could not load flows from database", + }); + } throw e; } };