未验证 提交 a8de2cf4 编写于 作者: N Nero 提交者: GitHub

update example according to feedback from PR

上级 c51054f2
......@@ -521,28 +521,11 @@ axios.get('/user/12345', {
}
});
// cancel the request (the message parameter is optional)
source.cancel('Operation canceled by the user.');
```
```js
var CancelToken = axios.CancelToken;
var source = CancelToken.source();
axios(
method: 'POST',
url: '/user/12345',
data: {
name: 'new name'
},
cancelToken: source.token
}).catch(function(thrown) {
if (axios.isCancel(thrown)) {
console.log('Request canceled', thrown.message);
} else {
// handle error
}
});
axios.post('/user/12345', {
name: 'new name'
}, {
cancelToken: source.token
})
// cancel the request (the message parameter is optional)
source.cancel('Operation canceled by the user.');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册