November 2017
Beginner to intermediate
398 pages
8h 42m
English
state () { return { // ... // Fetched details for the selected post selectedPostDetails: null, } }, getters: { // ... selectedPostDetails: state => state.selectedPostDetails, }, mutations: { // ... selectedPostDetails (state, value) { state.selectedPostDetails = value }, },
async selectPost ({ commit }, id) { commit('selectedPostDetails', null) commit('selectedPostId', id) const details = await $fetch(`posts/${id}`) commit('selectedPostDetails', details) },
unselectPost ...
Read now
Unlock full access