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