fix(web): circular dependencies (#1882)

This commit is contained in:
ze0s 2024-12-19 13:34:13 +01:00 committed by GitHub
parent 4432dfb099
commit 80423d6273
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 23 deletions

View file

@ -7,20 +7,20 @@ import { QueryCache, QueryClient } from "@tanstack/react-query";
import { toast } from "react-hot-toast";
import Toast from "@components/notifications/Toast";
import { AuthContext } from "@utils/Context";
import { redirect } from "@tanstack/react-router";
import { LoginRoute } from "@app/routes";
import { getRouteApi, redirect } from "@tanstack/react-router";
const MAX_RETRIES = 6;
export const queryClient = new QueryClient({
queryCache: new QueryCache({
onError: (error, query) => {
const loginRoute = getRouteApi("/login");
console.error(`Caught error for query '${query.queryKey}': `, error);
if (error.message === "Cookie expired or invalid.") {
AuthContext.reset();
redirect({
to: LoginRoute.to,
to: loginRoute.id,
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can