_toggleTrackedState(e) {
    if (!this._canUseApi()) {
      return;
    }

    const shouldTrack = e.currentTarget.checked;
    const targetApiMethod = shouldTrack ? 'doTrack' : 'doIgnore';

    this.isBusy = true;

    httpJsonp({
      url: this._getApiMethodUrl(targetApiMethod),
      callbackProp: 'callback',
      callback: data => {
        const { result } = data;
        if (result === 'success') {
          this.isTracked = !this.isTracked;
        }
      },
      error: error => {
        // eslint-disable-next-line no-console
        console.error('An error occurred when accessing `%s` API method.', targetApiMethod, error);
      },
      complete: () => {
        this.isBusy = false;
      },
    });
  }
/**
   * Method to call the API and toggle the tracked state.
   *
   * @param e
   * @private
   */
Method to call the API and toggle the tracked state.
@param e
@private
Method to call the API and toggle the tracked state . @param e @private
_toggleTrackedState(e) {
    if (!this._canUseApi()) {
      return;
    }
    const shouldTrack = e.currentTarget.checked;
    const targetApiMethod = shouldTrack ? 'doTrack' : 'doIgnore';
    this.isBusy = true;
    httpJsonp({
      url: this._getApiMethodUrl(targetApiMethod),
      callbackProp: 'callback',
      callback: data => {
        const { result } = data;
        if (result === 'success') {
          this.isTracked = !this.isTracked;
        }
      },
      error: error => {
        console.error('An error occurred when accessing `%s` API method.', targetApiMethod, error);
      },
      complete: () => {
        this.isBusy = false;
      },
    });
  }
_toggleTrackedState ( e ) { if ( ! this . _canUseApi ( ) ) { return ; } const shouldTrack = e . currentTarget . checked ; const targetApiMethod = shouldTrack ? 'doTrack' : 'doIgnore' ; this . isBusy = true ; httpJsonp ( { url : this . _getApiMethodUrl ( targetApiMethod ) , callbackProp : 'callback' , callback : data => { const { result } = data ; if ( result === 'success' ) { this . isTracked = ! this . isTracked ; } } , error : error => { console . error ( 'An error occurred when accessing `%s` API method.' , targetApiMethod , error ) ; } , complete : ( ) => { this . isBusy = false ; } , } ) ; }
Method to call the API and toggle the tracked state.
Method to call the API and toggle the tracked state .
// eslint-disable-next-line no-console