Skip to content

Commit

Permalink
Navigate back to home route onLogout.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonfancher committed Dec 14, 2024
1 parent df44078 commit 99952ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 4 additions & 8 deletions services/user/Chainmail/ui/src/components/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { useNavigate } from "react-router-dom";
import { LucideIcon } from "lucide-react";

import { cn } from "../lib/utils";
import { buttonVariants } from "../shad/components/ui/button";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "../shad/components/ui/tooltip";
import { useNavigate } from "react-router-dom";
import { buttonVariants } from "@shadcn/button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@shadcn/tooltip";
import { cn } from "@lib/utils";

interface NavProps {
isCollapsed: boolean;
Expand Down
3 changes: 3 additions & 0 deletions services/user/Chainmail/ui/src/hooks/use-logout.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useNavigate } from "react-router-dom";
import { useQueryClient, useMutation } from "@tanstack/react-query";

import { supervisor } from "src/main";

export const useLogout = () => {
const navigate = useNavigate();
const queryClient = useQueryClient();

return useMutation({
Expand All @@ -16,6 +18,7 @@ export const useLogout = () => {
});
},
onSuccess: () => {
navigate("/");
queryClient.refetchQueries({ queryKey: ["loggedInUser"] });
setTimeout(() => {
queryClient.refetchQueries({ queryKey: ["loggedInUser"] });
Expand Down

0 comments on commit 99952ce

Please sign in to comment.