import { signOut } from "next-auth/react";

export const logoutUser = async () => {
  try {
    // Call logout API (NO hooks!)

    // Next-auth signout
    await signOut({ redirect: false });

    // Clear browser storage
    window.localStorage.clear();

    // Clear React Query cache

    // Redirect to login/home
    window.location.href = "/";
    window.location.reload();
  } catch (err) {
    console.error("Logout error:", err);
  }
};
