Promise able for next ajax.
npm install -S afeiship/next-ajax-promise --registry=https://registry.npm.taobao.org
api | params | description |
---|---|---|
fetch | inMethod, inUrl, inData, inOptions | Send a request by XHR |
import NxAjaxPromise from 'next-ajax-promise';
// code goes here:
const res = NxAjaxPromise.fetch('get', 'https://api.github.com/users/afeiship', null,{ cancelable: true }).then(
(response) => {
console.log('response:->', response);
}
);
// cancel:
res.destroy();