I've modify the store.js file for supporting the init inside the nested modules.
I think we can do better and cleaner. Any advice?
// Automatically run the `init` action for every module,
// if one exists.
for (const moduleName of Object.keys(modules)) {
const subModules = modules[moduleName].modules
if (subModules) {
for (const subModuleName of Object.keys(subModules)) {
if (subModules[subModuleName].actions && subModules[subModuleName].actions.init) {
store.dispatch(`${moduleName}/${subModuleName}/init`)
}
}
} else {
if (modules[moduleName].actions && modules[moduleName].actions.init) {
store.dispatch(`${moduleName}/init`)
}
}
}
I've modify the store.js file for supporting the init inside the nested modules. I think we can do better and cleaner. Any advice?