diff --git a/web/src/components/header/Header.tsx b/web/src/components/header/Header.tsx index e44d696..4ed9aa0 100644 --- a/web/src/components/header/Header.tsx +++ b/web/src/components/header/Header.tsx @@ -5,7 +5,7 @@ import toast from "react-hot-toast"; import { useMutation, useQuery } from "@tanstack/react-query"; -import { useRouter } from "@tanstack/react-router"; +import { redirect } from "@tanstack/react-router"; import { Disclosure, DisclosureButton } from "@headlessui/react"; import { Bars3Icon, XMarkIcon, MegaphoneIcon } from "@heroicons/react/24/outline"; @@ -18,9 +18,9 @@ import { MobileNav } from "./MobileNav"; import { ExternalLink } from "@components/ExternalLink"; import { ConfigQueryOptions, UpdatesQueryOptions } from "@api/queries"; import { AuthContext } from "@utils/Context"; +import { LoginRoute } from "@app/routes.tsx"; export const Header = () => { - const router = useRouter() const { isError:isConfigError, error: configError, data: config } = useQuery(ConfigQueryOptions(true)); if (isConfigError) { @@ -39,7 +39,9 @@ export const Header = () => { )); AuthContext.reset(); - router.history.push("/"); + throw redirect({ + to: LoginRoute.to, + }) }, onError: (err) => { console.error("logout error", err)