nuxt , vuex 不返回登录的用户信息

问题描述

我正在使用 NodeJS 编写一个测试网站。

我在客户端使用 Vue 和 Nuxt。

我使用 Nuxt JS 的 auth 库进行用户注册

问题是在Vuex中没有显示登录用户,也没有用户登录

我的注册码是:

            let data = {
                name : this.name,email  : this.email,password : this.password
            }
            let response = await this.$axios.$post(`/api/auth/signup`,data);
            console.log(response)

                await this.$auth.loginWith('local',{
                    data : {
                        email : this.email,password : this.password
                    }
                });
                await this.$router.push('/')

我的 nuxt.config.js 身份验证选项是:

auth: {
localStorage : true,strategies: {
  local: {
    endpoints: {
      login: { url: '/api/auth/login',method: 'post',propertyName: 'token' },user: { url: '/api/auth/user',method: 'get',propertyName: 'user' }
    }
  }
}

}

这是我的 vuex 用户状态: enter image description here

我的问题到底是什么??

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)