I have inside my vuex store a function to create a post. And the function returns a json Object with a unique uuid from uuidv4()
. But if I run the function two times (or more) I get the same uuid and that's a problem.
(Only if I reload the page I get a new uuid).
// store.js
import uuidv4 from 'uuid/v4';
var uuid = uuidv4();
const state = {
postDetails: {
...
uuid: uuid,
...
}
}
const actions = {
post ({state}) {
var postArray = []
postArray.push(state.postDetails)
// some axios stuff...
}
}
So everything works fine. The main problem is the uuid which doesn't change after the function is called.
I use vuex-persistedstate
also