可能的未处理的承诺拒绝(id:0):TypeError:

时间:2018-07-20 13:28:30

标签: ios objective-c react-native

我正在为我的应用程序使用本机代码我收到此错误,

Possible Unhandled Promise Rejection (id: 0):
TypeError: _this.props.get_categories().then is not a function. (In '_this.props.get_categories().then(function (res) {
                console.log('attachment_res====>' + JSON.stringify(res));
              })', '_this.props.get_categories().then' is undefined)

我在action.js中编码了以下代码

export function get_categories() {
        return dispatch => AppAPI.categories.get('?filter={"where":{"is_active":1},"order":"is_featured desc","include":{"0":"attachment","service":{"where":{"is_active":1},"0":"attachment"}}}')
        .then((responseData) => {
                console.log('UserActions get categories res' + JSON.stringify(responseData) );
                return responseData;
            }).catch((err) => {
                console.log('UserActions get categories err' + JSON.stringify(err) );
                const error = AppAPI.handleError(err);
                return err;
            });
}

在场景中调用此代码

  get_attachments = async() => {
     await this.props.get_categories()
      .then((res) => {
        console.log('attachment_res====>' + JSON.stringify(res));
      }).catch((error) => {
        console.log('attachment_error====> ' + JSON.stringify(error));
      });
  }

有人可以帮助我解决此错误吗????请!!!!!

0 个答案:

没有答案
相关问题