"use client";

import { useEffect } from "react";
import { signOut } from "next-auth/react";
import { clearAuthCookies } from "@/lib/session";

export function SignOutHandler() {
  useEffect(() => {
    const handleSignOut = async () => {
      // Clear only auth-related cookies
      clearAuthCookies();
      
      // Then sign out from NextAuth
      await signOut({ 
        callbackUrl: "/signin",
        redirect: true 
      });
    };

    handleSignOut();
  }, []);

  return null;
} 