Skip to content

Commit

Permalink
fix: navigate when logout
Browse files Browse the repository at this point in the history
  • Loading branch information
joseglego committed Oct 14, 2024
1 parent 4e9ac69 commit 406bd21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link } from "@remix-run/react";
import { Link, useNavigate } from "@remix-run/react";
import { LogOut, Tickets, UserIcon, VenetianMaskIcon } from "lucide-react";
import { useMemo, useState } from "react";

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

export const Navbar = () => {
const navigate = useNavigate();
const isLogged = useIsLoggedIn();
const isAuthReady = useIsAuthReady();
const myProfile = useMyProfileQuery({
Expand Down Expand Up @@ -87,6 +88,7 @@ export const Navbar = () => {
icon: <LogOut className="mr-2 size-4" />,
onClick: () => {
logout().catch(console.error);
navigate(urls.home);
},
},
],
Expand All @@ -104,6 +106,7 @@ export const Navbar = () => {
isLogged,
myProfile?.data?.me?.isSuperAdmin,
setImpersonation,
navigate,
],
);

Expand Down

0 comments on commit 406bd21

Please sign in to comment.