Browse Source

feat: add query parameter while calling gql api from form view

re #608

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/628/head
Pranav C 3 years ago
parent
commit
46adf6b973
  1. 13
      packages/nc-gui/plugins/ncApis/gqlApi.js

13
packages/nc-gui/plugins/ncApis/gqlApi.js

@ -29,11 +29,14 @@ export default class GqlApi {
return data.data.data[this.gqlQueryCountName]
}
post(url, params) {
post(url, data, {
params = {}
} = {}) {
return this.$axios({
url: `${url}`,
method: 'post',
data: params
data,
params
})
}
@ -195,15 +198,15 @@ export default class GqlApi {
return data1.data.data[this.gqlMutationUpdateName]
}
async insert(data, params = {}) {
async insert(data, params) {
const data1 = await this.post(`/nc/${this.$ctx.projectId}/v1/graphql`, {
query: `mutation create($data:${this.tableCamelized}Input){
${this.gqlMutationCreateName}(data: $data){${this.gqlReqBody}${await this.gqlRelationReqBody(params)}}
${this.gqlMutationCreateName}(data: $data){${this.gqlReqBody}${await this.gqlRelationReqBody({})}}
}`,
variables: {
data
}
})
}, params)
return data1.data.data[this.gqlMutationCreateName]
}

Loading…
Cancel
Save