Skip to content

Commit 6e207d9

Browse files
committed
fix: navigate when logout
1 parent 4e9ac69 commit 6e207d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: app/components/Navbar/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Link } from "@remix-run/react";
1+
import { Link, useNavigate } from "@remix-run/react";
22
import { LogOut, Tickets, UserIcon, VenetianMaskIcon } from "lucide-react";
33
import { useMemo, useState } from "react";
44

@@ -18,6 +18,7 @@ import { ThemeSwitcher } from "./ThemeSwitcher";
1818
import type { NavbarMenuItem } from "./types";
1919

2020
export const Navbar = () => {
21+
const navigate = useNavigate();
2122
const isLogged = useIsLoggedIn();
2223
const isAuthReady = useIsAuthReady();
2324
const myProfile = useMyProfileQuery({
@@ -87,6 +88,7 @@ export const Navbar = () => {
8788
icon: <LogOut className="mr-2 size-4" />,
8889
onClick: () => {
8990
logout().catch(console.error);
91+
navigate(urls.home);
9092
},
9193
},
9294
],
@@ -104,6 +106,7 @@ export const Navbar = () => {
104106
isLogged,
105107
myProfile?.data?.me?.isSuperAdmin,
106108
setImpersonation,
109+
navigate
107110
],
108111
);
109112

0 commit comments

Comments
 (0)