Fix: Prevent Error Popups When Session Expires During Logout (#7455)

🔧 (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.
This commit is contained in:
Cristhian Zanforlin Lousa 2025-04-09 17:45:27 -03:00 committed by GitHub
commit b2c74173b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View file

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

View file

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