import { logout } from "@/app/store/slices/authSlice";
import { useRouter } from "next/navigation";
// export const userLogout = (dispatch: Function, router: any): boolean => {
    
//     dispatch(logout());
//     router.push("/login");
//     return true; 
// };
export const userLogout = (dispatch: Function, router: any) => {
  dispatch(logout()); // Clear user from state and cookies
  router.replace("/login"); // Redirect immediately without leaving history
};
