How to use the axios.isCancel function in axios

To help you get started, we’ve selected a few axios examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EventKit / eventkit-cloud / eventkit_cloud / ui / static / ui / app / actions / userGroupsActions.fake.js View on Github external
}).catch((error) => {
            if (axios.isCancel(error)) {
                console.log(error.message);
            } else {
                mock.restore(); //// JUST FOR MOCKING
                dispatch({ type: types.FETCH_GROUPS_ERROR, error: error.response.data });
            }
        });
    };
github Qiuyaxian / lm-ui / lm-vue / src / utils / httpRequest.js View on Github external
}, error => {
  let message = '';
  if(axios.isCancel(error)) {
    source.cancel('ε–ζΆˆη½‘η»œθ―·ζ±‚')
  }  
  // ζŠ›ε‡Ίι”™θ――
  if(error && error.response){  
    let { response } = error,
        { status, data, config: responseConfig } = response,
        { method: methodType } = responseConfig;
    switch(status){
      //ι”™θ――ηš„θ―·ζ±‚
      case '400':
        message = `400:${ methodType }:ζœεŠ‘ε™¨δΈη†θ§£θ―·ζ±‚ηš„θ―­ζ³•`;
      break;
      case '403':
        message = `403:${ methodType }:ζœεŠ‘ε™¨ζ‹’η»θ―·ζ±‚`;
      break;
      //鑡青丒倱
github infinitered / apisauce / lib / apisauce.js View on Github external
var convertResponse = curry(function (startedAt, axiosResult) {
        var end = toNumber(new Date());
        var duration = end - startedAt;
        // new in Axios 0.13 -- some data could be buried 1 level now
        var isError = axiosResult instanceof Error || axios.isCancel(axiosResult);
        var axiosResponse = axiosResult;
        var axiosError = axiosResult;
        var response = isError ? axiosError.response : axiosResponse;
        var status = (response && response.status) || null;
        var problem = isError
            ? getProblemFromError(axiosResult)
            : getProblemFromStatus(status);
        var originalError = isError
            ? axiosError
            : null;
        var ok = in200s(status);
        var config = axiosResult.config || null;
        var headers = (response && response.headers) || null;
        var data = (response && response.data) || null;
        // give an opportunity for anything to the response transforms to change stuff along the way
        var transformedResponse = {
github photoprism / photoprism / frontend / src / pages / library / originals.vue View on Github external
}).catch(function (e) {
                    Notify.unblockUI();

                    if (Axios.isCancel(e)) {
                        // run in background
                        return
                    }

                    Notify.error(this.$gettext("Indexing failed"));

                    ctx.busy = false;
                    ctx.completed = 0;
                    ctx.fileName = '';
                });
            },
github algorithm-visualizer / algorithm-visualizer / src / components / Player / index.js View on Github external
.catch(error => {
          if (axios.isCancel(error)) return;
          this.tracerApiSource = null;
          this.setState({ building: false });
          this.handleError(error);
        });
    } else {
github Kamahl19 / react-starter / src / packages / api-client / index.ts View on Github external
(error: AxiosError) => {
      onApiCallFinish(error.config.apiCallId);

      if (!axios.isCancel(error)) {
        onError(error);
        throw error;
      }
    }
  );
github uploadcare / uploadcare-upload-client / src / api / request.ts View on Github external
private handleRequestError = (error: AxiosError) => {
    const {path: url} = this.options

    if (axios.isCancel(error)) {
      throw new CancelError()
    }

    if (error.response) {
      throw new RequestError({
        headers: error.config.headers,
        url: error.config.url || url,
      }, {
        status: error.response.status,
        statusText: error.response.statusText,
      })
    }

    throw error
  }
github onlineconf / onlineconf / admin / js / src / components / GlobalLog.tsx View on Github external
const filter: API.GlobalLogFilter = {
			author: this.state.author,
			branch: this.state.branch,
			from: this.state.from,
			till: this.state.till,
			all: this.state.all,
		};
		try {
			this.setState({ loading: true });
			this.cts = axios.CancelToken.source();
			const data = await API.getGlobalLog(filter, { cancelToken: this.cts.token });
			this.setState({ data, loading: false });
			onLoaded();
		} catch (error) {
			this.setState({ loading: false });
			if (axios.isCancel(error)) {
				onLoaded();
			} else {
				onError(error);
			}
		}
	}
github egm0121 / splitcloud-app / components / songPicker.js View on Github external
}).then((val) => {
      if(axios.isCancel(val)) return false;
      this.props.onLoadingStateChange(false);
    });
    return requestPromise;
github h3poteto / megalodon / src / mastodon.ts View on Github external
.catch((err: Error) => {
        if (axios.isCancel(err)) {
          throw new RequestCanceledError(err.message)
        } else {
          throw err
        }
      })
      .then((resp: AxiosResponse) => {