'use client';

import { authClient } from '@/lib/auth-client';
import { useRouter } from 'next/navigation';

export function SignOutButton() {
  const router = useRouter();

  const handleSignOut = async () => {
    await authClient.signOut();
    router.push('/sign-in');
    router.refresh();
  };

  return (
    <button
      onClick={handleSignOut}
      type="button"
      style={{
        padding: '8px 16px',
        background: '#f1f5f9',
        border: '1px solid #e2e8f0',
        borderRadius: 8,
        cursor: 'pointer',
        fontWeight: 500,
      }}
    >
      Выйти
    </button>
  );
}
