November 2017
Beginner to intermediate
398 pages
8h 42m
English
First, we will implement the logout action.
logout ({ commit }) { commit('posts', { posts: [], mapBounds: null, }) },
logout ({ commit, dispatch }) { commit('user', null) $fetch('logout') // ... dispatch('posts/logout') },
This is going to work, but we can improve this code--we could define the logout action of the posts namespaced submodule as a root action. That way, when we dispatch the 'logout' action, both the logout and the posts/logout will be called!
logout: { handler ({ commit ...Read now
Unlock full access