I was wondering how to handle login/logout of the user so I did this:
store.commit('load_state');
store.subscribe((mutations, state) => {
ApplicationSettings.setString('store', JSON.stringify(state));
});
new Vue({
store,
render: h => h('frame', [h(store.state.is_logged_in ? App : Login)]),
created() {
this.$store.commit('setNav', this.$navigateTo);
if (this.$store.state.is_logged_in) {
this.$store.dispatch('init');
}
},
}).$start();
please note that loadstate initially loads the state from applicationsettings. But the problem with this solution is that this.$store is not available in the child components of Login.vue What would be the correct way to do this?
Please note that I'm not using vue-router here.