fix(web): honor baseURL path when logging out (#1851)

This commit is contained in:
martylukyy 2024-12-06 13:21:02 +01:00 committed by GitHub
parent 66696dcb18
commit a6b463fb69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 = () => {
<Toast type="success" body="You have been logged out. Goodbye!" t={t} />
));
AuthContext.reset();
router.history.push("/");
throw redirect({
to: LoginRoute.to,
})
},
onError: (err) => {
console.error("logout error", err)