mirror of
https://github.com/journey-ad/Bitmagnet-Next-Web
synced 2024-11-21 17:39:35 +00:00
3a88b39e3b
Some hard work. 🧑💻
20 lines
530 B
TypeScript
20 lines
530 B
TypeScript
import { ApolloClient, InMemoryCache, from, HttpLink } from "@apollo/client";
|
|
import { removeTypenameFromVariables } from "@apollo/client/link/remove-typename";
|
|
|
|
import { getBaseUrl } from "@/utils/api";
|
|
|
|
const httpLink = new HttpLink({
|
|
uri: `${getBaseUrl()}/api/graphql`, // 从环境变量中获取 URI
|
|
});
|
|
|
|
const removeTypename = removeTypenameFromVariables();
|
|
|
|
const client = new ApolloClient({
|
|
cache: new InMemoryCache({
|
|
addTypename: false,
|
|
}),
|
|
link: from([removeTypename, httpLink]),
|
|
});
|
|
|
|
export default client;
|