"use client";

import { useRouter } from "next/navigation";
import { createClient } from "@/lib/supabase/client";

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

  async function signOut() {
    const supabase = createClient();
    await supabase.auth.signOut();
    router.push("/auth/login");
    router.refresh();
  }

  return (
    <button className="btn btn-ghost" style={{ padding: "0.35rem 0.8rem", fontSize: "0.72rem" }} onClick={signOut}>
      Sign out
    </button>
  );
}
