24 lines
533 B
TypeScript
24 lines
533 B
TypeScript
"use client";
|
|
|
|
import { useToast } from "@/components/ui/use-toast";
|
|
import { logout } from "@/server/actions/authentication/logout";
|
|
import { LogOutIcon } from "lucide-react";
|
|
import Link from "next/link";
|
|
|
|
export function LogoutButton() {
|
|
const { toast } = useToast();
|
|
function onClick() {
|
|
toast({
|
|
description: "Du wirst nun abgemeldet...",
|
|
});
|
|
logout();
|
|
}
|
|
|
|
return (
|
|
<Link href="/" onClick={onClick} className="flex items-center gap-2">
|
|
<LogOutIcon className="w-4 h-4" />
|
|
<span>Abmelden</span>
|
|
</Link>
|
|
);
|
|
}
|