feat: nested read api

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
This commit is contained in:
Pranav C
2021-07-28 17:39:22 +05:30
parent 4621a77ca5
commit 4a8282bace
6 changed files with 88 additions and 12 deletions

View File

@@ -65,8 +65,8 @@ export default class GqlApi {
return `{${this.gqlQueryListName}${this.generateQueryParams(params)}{${this.gqlReqBody}${await this.gqlRelationReqBody(params)}}}`
}
gqlReadQuery(id) {
return `{${this.gqlQueryReadName}(id:"${id}"){${this.gqlReqBody}}}`
async gqlReadQuery(id) {
return `{${this.gqlQueryReadName}(id:"${id}"){${this.gqlReqBody}${await this.gqlRelationReqBody(params)}}}`
}
gqlCountQuery(params) {
@@ -209,7 +209,7 @@ export default class GqlApi {
async read(id) {
const data = await this.post(`/nc/${this.$ctx.projectId}/v1/graphql`, {
query: this.gqlReadQuery(id),
query: await this.gqlReadQuery(id),
variables: null
})
return data.data.data[this.gqlQueryReadName]