Store-wide reset on login/logout
How to review this
The most important part is in js/store/index.js
: The whole store module handling is rewritten to be dynamic.
When a new store module is added, a string is added to the moduleNames
array. A modules
object is then built, dynamically importing everything. The main use of this array is that we can loop through it and call mutations on each module; that's how the store-wide reset works.
All state
s in modules are replaced by initialState
functions, to create new objects and always trigger Vue's reactivity.
All the other changes are about renaming clear
mutations to reset
, updating tests, and making the auth
module trigger resets on login and logout.
Edited by Erwan Rouchet