apollo graphQL-如何按角度发送突变形式的对象数组

时间:2019-02-14 03:08:54

标签: graphql apollo apollo-client

我想在graphQL中发送对象数组,但是当我发送数组时,收到错误错误请求

 createGift(gift, categoryid, url, banner,occasionid) {
    let connectQuery='';
    for (var i = 0; i < occasionid.length; i++) 
    {connectQuery+=`{"id":"${occasionid[i]}"}`}
console.log(connectQuery)
    return this.apollo.mutate({
      mutation : this.mutation,
       variables: {
        "input": {
             "name": `${gift.name}`,
             "description": `${gift.description}`, 
             "imageIcon": `${url}`,
             "price": `${gift.price}`,
             "category":{
                  "connect":{"id": `${categoryid}`}
                  },
              "occasions":{
                  "connect":`[${connectQuery}]`
              }, 
              "banners":  {
                  "set": banner}  
         }         
      }

    });
  }
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.2/angular.min.js"></script>

是否可以发送它?

0 个答案:

没有答案