let cancellableRequest = {
name: 'axios-cancellable-request',
req: function (payload) {
let jsonApi = payload.jsonApi
return jsonApi.axios(payload.req, {
cancelToken: new jsonApi.axios.CancelToken(function executor(c) {
// An executor function receives a cancel function as a parameter
jsonApi.cancel = c;
})
})
}
}
But it doesn't work this way. And I can't see axios taking two params:
The part of the README on cancellable requests says:
But it doesn't work this way. And I can't see
axios
taking two params:index.js -> require('./lib/axios') lib/axios/index.js -> var axios = createInstance(...) lib/axios/index.js: createInstance -> var instance = bind(Axios.prototype.request, ...); lib/axios/index.js -> module.exports = axios Axios.prototype.request
So, the code is supposed to read: