https://dev.kronoz.win/r/marzneshin.git
| 1 |
1c0d1b7 |
Dawsh |
2y ago |
import { Button } from "@marzneshin/components"; |
| 2 |
1c0d1b7 |
Dawsh |
2y ago |
import { useNavigate } from "@tanstack/react-router"; |
| 3 |
1c0d1b7 |
Dawsh |
2y ago |
import { LogOut } from "lucide-react"; |
| 4 |
1c0d1b7 |
Dawsh |
2y ago |
import { FC, useCallback } from "react"; |
| 5 |
13e20b0 |
Mrdn |
2y ago |
|
| 6 |
13e20b0 |
Mrdn |
2y ago |
interface LogoutProps { } |
| 7 |
13e20b0 |
Mrdn |
2y ago |
|
| 8 |
13e20b0 |
Mrdn |
2y ago |
export const Logout: FC<LogoutProps> = () => { |
| 9 |
1c0d1b7 |
Dawsh |
2y ago |
const navigate = useNavigate({ from: "/" }); |
| 10 |
1c0d1b7 |
Dawsh |
2y ago |
const handleLogout = useCallback(() => { |
| 11 |
1c0d1b7 |
Dawsh |
2y ago |
navigate({ to: "/login" }); |
| 12 |
1c0d1b7 |
Dawsh |
2y ago |
}, [navigate]); |
| 13 |
13e20b0 |
Mrdn |
2y ago |
return ( |
| 14 |
1c0d1b7 |
Dawsh |
2y ago |
<Button |
| 15 |
3c1143b |
Mardin |
2y ago |
size="sm" |
| 16 |
3c1143b |
Mardin |
2y ago |
variant="ghost" |
| 17 |
1c0d1b7 |
Dawsh |
2y ago |
onClick={handleLogout} |
| 18 |
3c1143b |
Mardin |
2y ago |
className="hstack gap-1 items-center justify-between w-full h-fit p-0" |
| 19 |
1c0d1b7 |
Dawsh |
2y ago |
> |
| 20 |
3c1143b |
Mardin |
2y ago |
Logout |
| 21 |
3c1143b |
Mardin |
2y ago |
<LogOut className="size-4" /> |
| 22 |
13e20b0 |
Mrdn |
2y ago |
</Button> |
| 23 |
13e20b0 |
Mrdn |
2y ago |
); |
| 24 |
1c0d1b7 |
Dawsh |
2y ago |
}; |