import { useEffect } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { useAuthStore } from "@/stores/auth";

export const useInitializeApp = () => {
  const { loading, initialize, user } = useAuthStore();
  const queryClient = useQueryClient();

  const isLoading = loading;

  useEffect(() => {
    initialize(queryClient);
  }, []);

  return { isLoading, isLoggedIn: !!user };
};
