Ionic3 HTTP native

#1

Hi team,

I am facing an issue with ionic3 native HTTP client. I am getting the following error.

 {"__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}

May I know what is the issue and how can I resolve it.

Thanks

#2

You should always provide some code snippet for fast response.

#3

This my common API service. All the API calls are passed through this service. Only in some cases i am getting the above mentioned error.

  httpGet(url, successCallback, errorCallback) {
    let nav = this.appCtrls.getActiveNav();
    this.validateApiToken().then(response => {
      const gpsLocation = this.ngps.getGpsLocation()

      const obj = {
        'x-authenticated-user-token': this.currentUser.curretUser.accessToken,
        'gpsLocation': gpsLocation ? gpsLocation : '0,0'
      }
      this.http.setDataSerializer('json');

      let headers = new Headers(obj);
      const apiUrl = AppConfigs.api_base_url + url;
      this.http.get(apiUrl, {}, obj).then( data => {
        successCallback(JSON.parse(data.data));
      }).catch( error => {
        const errorDetails = JSON.parse(error['_body']);
        if (errorDetails.status === "ERR_TOKEN_INVALID") {
          this.auth.doLogout().then(success => {
            this.reLoginAlert();
          }).catch(error => {
          })
        } else {
          this.utils.openToast(error.message, 'Ok');
        }
        this.utils.openToast(error.message, 'Ok');
        errorCallback(error);
      })
    }).catch(error => {
      this.utils.openToast("Something went wrong. Please try again", 'Ok');
      errorCallback(error);
    })
  }