title | description | prev_title | prev_link | next_title | next_link |
---|---|---|---|---|---|
POST リクエスト |
Axios で POST リクエストを実行する方法 |
最小構成の使用例 |
/docs/example |
Axios API |
/docs/api_intro |
POST
リクエストの実行
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
複数のリクエストの並列処理
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
Promise.all([getUserAccount(), getUserPermissions()])
.then(function (results) {
const acct = results[0];
const perm = results[1];
});