import { ApolloClient, InMemoryCache } from "@apollo/client";
import { createUploadLink } from "apollo-upload-client";
import fetch from "cross-fetch";
import dotenv from "dotenv";

dotenv.config();
const API_BASE_URL = process.env.API_BASE_URL || "https://core.toystack.ai";

const client = new ApolloClient({
	//link: new HttpLink({ uri: process.env.TOYSTACK_BACKEND_URL, fetch }),
	link: createUploadLink({
		uri: API_BASE_URL,
		fetch,
	}),
	cache: new InMemoryCache(),
});

export default client;
