https://api.quickblox.com/chat/Dialog.json 422 (необработанный объект) - PullRequest
0 голосов
/ 13 октября 2018

Я хочу создать диалог для чата с другим пользователем и установить сообщение в истории чата quickblox, поэтому при создании диалога с помощью quickblox.chat.dialog.create (params, (err, madeDialog)) api я получаю сообщение об ошибкекак показано ниже:

err {code: 422, 
status: "error", 
message: {…}, 
detail: {…}}
code: 422
detail: base: ["Forbidden. Need user."]

createdDialog null

Мой код:

console.log("chat password", window.localStorage.getItem('password'));
    quickblox.init(this.CREDENTIALS.appId, this.CREDENTIALS.authKey, this.CREDENTIALS.authSecret);
    quickblox.createSession({ login: this.user.login, password: this.user.password }, (err, result) => {
      console.log("result", result);

      quickblox.chat.connect({ 'userId': this.qbUser_Id, 'password': window.localStorage.getItem('password') }, (err, roster) => {
        console.log("chat err", err);
        console.log("chat roster", roster);

        console.log("this.occupentsId", this.occupentsId);

        var params = {
          type: 'Conversation',
          occupants_ids: this.occupentsId
        };

        quickblox.chat.dialog.create({type: 3, occupants_ids: this.occupentsId}, (err, createdDialog) => {
          console.log("err", err);
          console.log("createdDialog", createdDialog);

          console.log(err);
          if (err) {
            console.log("iff err", err);
          } else {
            console.log("else createdDialog", createdDialog);
          }
        });

        // let filters = null;

        // quickblox.chat.dialog.list(filters, function(err, resDialogs) {
        //   if (err) {
        //     console.log(err);
        //   } else {
        //     console.log("resDialogs", resDialogs);
        //   }
        // });
        // if (err) reject(err); else {
          // resolve();
        // }//else
      });//chat connect
    });

Мне нужно решение, чтобы получить ответ и устранить ошибку пользователя с запрещенной потребностью, так что я могу сделать?

...