import {useSessionStore} from "@/lib/store/sessionStore";
import {useRouter} from "@tanstack/react-router";

export const useLogout = () => {
    const {clearSession} = useSessionStore();
    const router = useRouter();
    const logout = async () => {
        router.invalidate();
        router.clearCache();
        clearSession();

        window.location.reload();
    };

    return logout;
};
