How does vuex store the requested data into store in a public js?

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 ~

Jan.08,2022

you have asked for data, so there is no need to use actions, right? just commit it?

store.commit('adduser',user)

Asynchronous can use actions, in store, but ultimately modify the data using mutations's interface. It is recommended that you first refer to the official website to write demo

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e493c9-44d19.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e493c9-44d19.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?