mirror of
https://github.com/journey-ad/Bitmagnet-Next-Web
synced 2024-11-22 01:51:23 +00:00
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;
|