问题
Short Question: Is it possible to update the user data in Vuex manually via the Nuxt Auth Module?
Why do I have that Question: My problem is this. I save some Likes/Follows in MongoDB in the user document. My authentication is realized with Nuxt Auth. Nuxt Auth stores my user document in Vuex on login.
If an user likes something now, it will be stored in the database, but I don't get it into the auth state of Nuxt Auth in Vuex.
An alternative (I thought) would be to change the data in Vuex the same way as in the database. But here I get problems with the "Strict" mode of Vuex.
One possibility that works for me would be to save the user data one more time in a separate state and always update it manually. But do I really have to save the user data several times in Vuex? Doesn't make sense to me.
回答1:
Now I found a solution. It is as simple as:
this.$auth.fetchUser()
but I couldn't find it anywhere in the documentation.
Source: https://nuxt-auth.herokuapp.com/
来源:https://stackoverflow.com/questions/56233773/how-to-refetch-user-in-vuex-with-nuxt-auth-module