【发布时间】:2021-08-09 21:35:00
【问题描述】:
Inertia 提供了一个非常酷的辅助方法,我建议它基于 axios,例如:
Inertia.post('/users', {
name: 'John Doe',
email: 'john.doe@example.com',
})
我在 Inertia 文档中没有找到它,所以我在这里问 - 是否有可能像使用 axios 一样使用 Inertia 执行多个 HTTP 请求?
// execute simultaneous requests
axios.all([
axios.get('https://api.github.com/users/mapbox'),
axios.get('https://api.github.com/users/phantomjs')
])
.then(responseArr => {
//this will be executed only when all requests are complete
console.log('Date created: ', responseArr[0].data.created_at);
console.log('Date created: ', responseArr[1].data.created_at);
});
或者我应该只使用 axios 来做到这一点?
【问题讨论】: