简体   繁体   English

角阿波罗错误请求

[英]angular Apollo Bad Request

hello dear developers actually i have a problem i'm using Appollo in my Ionic/Angular project and i have this simple mutation in my code你好亲爱的开发人员实际上我有一个问题我在我的 Ionic/Angular 项目中使用 Appollo 并且我的代码中有这个简单的变化

CreateUser(email,phone_num,password){    
    return this.apollo
    .mutate<any>({
      mutation: gql`
      mutation create_user($email:String!,$phone_num:String!,$password:String!) {
        create_user(input:{email:$email,phone_num:$phone_num,password:$password}){
          user {
            id
            first_name
            last_name
            phone_num
            email
            biography
            gender
            profile_picture
            created_at
            is_active
          }
    message
    ok
    }
} 
      `,
      variables:{
        email:email,
        phone_num:phone_num,
        password:password
      },
    })
  }

when i execute this query in the backend(django) graphical page its working but in the angular project returns bad request 400 what should i do ?当我在后端(django)图形页面中执行此查询时,它可以正常工作,但在 angular 项目中返回错误请求 400 我该怎么办?

i got it and problem was from types this code is worked我明白了,问题出在此代码有效的类型中

CreateUser(email,phone_num,password){    
    return this.apollo
    .mutate<any>({
      mutation: gql`
      mutation create_user($email:String!,$phone_num:String!,$password:String!) {
        create_user(input:{email:$email,phone_num:$phone_num,password:$password}){
          user {
            id
            first_name
            last_name
            phone_num
            email
            biography
            gender
            profile_picture
            created_at
            is_active
          }
    message
    ok
    }
} 
      `,
      variables:{
        email:String(email),
        phone_num:String(phone_num),
        password:String(password)
      },
    })
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM