当我使用localStorage时,我有以下错误: Uncaught (承诺) TypeError:无法读取未定义的属性(读取‘令牌’)。但我的钱在这里

承诺在这里,,

async loginSubmit () {
const response = axios.post('http://localhost:3000/api/auth/login', {
email: this.email,
password: this.password
});
localStorage.setItem('token', response.data.token);
console.log(response);
this.$router.push('actu');
},你能帮我吗?请
发布于 2022-05-12 09:21:47
Axios返回一个承诺,您需要等待请求:
const response = await axios.post(...)https://stackoverflow.com/questions/72213008
复制相似问题