Add cell-click event handler and related variables

This commit is contained in:
Dede Fuji Abdul
2024-03-28 20:24:20 +07:00
parent 8717d4b8cb
commit c7bbf61878
2 changed files with 114 additions and 56 deletions

View File

@ -1,5 +1,11 @@
//deploy vm
import { ApolloClient, createHttpLink, gql, InMemoryCache } from '@apollo/client/core'
import {
ApolloClient,
createHttpLink,
gql,
InMemoryCache,
type DocumentNode
} from '@apollo/client/core'
import axios from 'axios'
const controller = new AbortController()
const url = import.meta.env.VITE_APP_GRAPHQL_ENDPOINT
@ -13,9 +19,11 @@ const instance = axios.create({
signal: controller.signal
})
export const requestGraphQl = async (query: string, data: any) => {
export const getQueryString = (query: DocumentNode) => query.loc?.source.body!
export const requestGraphQl = async (query: DocumentNode, data: any) => {
return await instance.post('', {
query: query,
query: getQueryString(query),
variables: data
})
}