When trying to unregister a module with this.$store.unregisterModule([ModulePath, ModuleName])
, sometimes I get this warning console [vuex] trying to unregister module 'ModulePath\ModuleName', which is not registered
I'm wondering if there is a way to check if a specific module is registered? so I can make a conditional unregistration like this:
if(module ModuleName is registered) {
this.$store.unregisterModule([ModulePath, ModuleName])
}
You can do it by calling store.hasModule
.
From Vuex documentation:
Note that you may check if the module is already registered to the store or not via store.hasModule(moduleName) method.