如何解决从Linux到Windows的Projet laravel / vuejs
我尝试将在linux上创建的项目传递给Windows,但出现问题。 在我的项目中,我有一个数据库,一切都很好,我可以登录并在表中看到我的帐户。
现在我的登录功能在auth.js(商店)中
async login({ dispatch },credentials){
let response = await axios.post(`/api/auth/connexion`,credentials);
if(!response.data.error){
dispatch('attempt',response.data.token).then((resp)=> {
if(resp){
dispatch('message/resetState',null,{root: true});
router.push({ name: 'Home',query: {category: 'home'} });
}
});
}else {
dispatch('message/setError',response.data.error,{root: true});
}
}
还有我的dispatch('attempt',response.data.token);
async attempt({ commit,state },token) {
if(token){
commit('SET_TOKEN',token);
}
if (!state.token){
return
}
try{
let response = await axios.get(`/api/auth/me`);
commit('SET_USER',response.data);
response = await axios.get(`/api/auth/isAdmin`);
commit('SET_ADMIN',response.data);
return true;
}
catch(err){
commit('SET_TOKEN',null);
commit('SET_USER',null);
commit('SET_ADMIN',null);
}
}
如果打印出了console.log令牌,但是它是:
await axios.get(`/api/auth/me`)
不起作用,我发现了原因,这是因为我的方法登录和登录位于中间件之外:
$this->middleware('auth:api',['except' => ['login','register']]);
我的问题是:
为什么我的身份验证中间件未设置且无法正常工作?
该项目在我在Linux上的另一台PC上都能正常工作。 感谢您的帮助!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。