axios - 如何使用惯性发送多个 HTTP 请求
问题描述
Inertia 提供了一个非常酷的辅助方法,它基于 axios,我建议,例如:
Inertia.post('/users', {
name: 'John Doe',
email: 'john.doe@example.com',
})
我在 Inertia 文档中没有找到它,所以我在这里问 - 是否有可能使用 Inertia 执行多个 HTTP 请求,就像使用 axios 一样?
// 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 来做到这一点?
解决方案
推荐阅读
- django - 使用 Ajax 和 Django 添加注释
- php - 如何修复“此路线不支持 GET 方法。支持的方法:POST。'?
- java - 为什么直接写入文件时PrintWriter中没有autoflush参数?
- python - 用 pandas 计算分组的总数
- python - 如何检查所有包是否满足版本要求?
- typescript - 打字稿路径在 tsconfig.json 中不起作用
- javascript - 如果出现以下情况,如何禁用 HTML 元素
- css - 在列填充网格中跨越列的元素
- python-3.x - python3 a==c,b==d,a==b,但是c不等于d,请帮我理解为什么
- r - R中的单面HP过滤器