topic description
when writing a vue project, using vuex, I now encapsulate the public methods into a separate js file. When requesting a background interface, how do I store the requested data in store?
related codes
import store from "@/store"
async getUserInfo () { //
try {
let user = await getUser()
// store.default.dispatch("user/USER_GET_INFO", user)
//
return user
} catch (e) {
return false
}
}
what result do you expect? What is the error message actually seen?
Please give your advice, thank you ~