16 lines
325 B
TypeScript
16 lines
325 B
TypeScript
import { GraphQLClient } from "graphql-request";
|
|
|
|
export default defineNuxtPlugin(() => {
|
|
const config=useRuntimeConfig();
|
|
|
|
const endpoint = process.server
|
|
? config.graphqlEndpoint
|
|
: config.public.graphqlEndpoint
|
|
|
|
const client = new GraphQLClient(endpoint);
|
|
return {
|
|
provide: {
|
|
gql: client
|
|
}
|
|
}
|
|
}); |