mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
LogOutButton component
This commit is contained in:
17
packages/frontend/src/components/log-out-button.tsx
Normal file
17
packages/frontend/src/components/log-out-button.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { LogOut } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export default function LogOutButton() {
|
||||
const logOut = () => {
|
||||
localStorage.removeItem("token");
|
||||
localStorage.removeItem("user");
|
||||
window.location.href = "/";
|
||||
};
|
||||
|
||||
return (
|
||||
<Button onClick={logOut} variant={"destructive"} className="flex gap-2 items-center">
|
||||
Log out
|
||||
<LogOut size={15} />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user