rallly/apps/web/src/app/components/logout-button.tsx
2025-01-03 21:59:17 +00:00

24 lines
475 B
TypeScript

"use client";
import type { ButtonProps } from "@rallly/ui/button";
import { Button } from "@rallly/ui/button";
import { useUser } from "@/components/user-provider";
export function LogoutButton({
children,
onClick,
...rest
}: React.PropsWithChildren<ButtonProps>) {
const { logout } = useUser();
return (
<Button
{...rest}
onClick={async (e) => {
await logout();
onClick?.(e);
}}
>
{children}
</Button>
);
}