Skip to content

Instantly share code, notes, and snippets.

@nejtr0n
Forked from stephanepericat/nested-vuex-modules.js
Created August 9, 2018 17:36
Show Gist options
  • Select an option

  • Save nejtr0n/a55d37d39af36af6e27d78ee186bf803 to your computer and use it in GitHub Desktop.

Select an option

Save nejtr0n/a55d37d39af36af6e27d78ee186bf803 to your computer and use it in GitHub Desktop.

Revisions

  1. @stephanepericat stephanepericat renamed this gist Jan 12, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @stephanepericat stephanepericat created this gist Jan 12, 2018.
    37 changes: 37 additions & 0 deletions nest-vuex-modules.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    export default {
    namespaced: true,
    state: {
    firstname: 'John',
    lastname: 'Doe',
    email: '[email protected]'
    },
    getters: {
    fullname: state => `${state.firstname} ${state.lastname}`
    },
    mutations: {
    updatemail(state, email) {
    state.email = email;
    }
    },
    actions: {
    emailupdate(context, email) {
    context.commit('updatemail', email);
    }
    },
    modules: {
    account: {
    state: {
    type: 'Admin',
    created: '2018-01-12 21:33:54 UTC',
    active: true
    }
    },

    posts: {
    namespaced: true,
    state: {
    articles: [...]
    }
    }
    }
    };