0
Currently I have a structure with Nuxt and Vuex in the project, there is an object that comes directly from an Api and I need to make it change the state from "false" to "true" if the API returns it as true, so it will display 1 field in the menu, but in vuex he is saving in localstorage and there is that change of state.
Code of the vuex
state: {
user: {},
}
actions: {
async betaUpdate(context, user) {
const usuario = (await Axios.get(`http://api-interna/me/${usuarioId}`)).data
}
within user I receive information like beta: user.beta, betachart: user.betachart,
however in this my API I want to check if internally whenever there is an update in these two fields and change their false value to true if the API returns true,
in VUE I put a mapActions, calling the action but I can’t (I don’t know) make the change if there is a TRUE return from the Api above.
Problem still remains because, I receive in my State.user a usuer: {} because it is empty, I receive it after some time and when I make the call of the ...mapState(["betaChange"]), in the component it about writes and then keeps it empty. I would have to isolate or capture only these two Beta and betaCharts fields to modify only them, and I cannot do this intervention only in these two fields without reassembling the entire object
– leonardo silva