我将 sanctum 用于我的 vue Axios 操作。我部署到我的共享主机并在 chrome 控制台中收到此错误:
GET http://foo.xyz/city 401(未经授权)
bootstrap.js:
window._ = require('lodash');
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
window.axios.defaults.withCredentials = true;
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
Axios 获取:
getCity() {
axios.get('/api/city')
.then((response) => {
this.cities= response.data;
})
.catch(function (error) {
console.log(error);
});
},
当我将这个项目部署到我的共享主机中时,一切都在我的本地主机中运行没有任何效果,那么我如何在我的共享主机中运行它?