-
-
Save anonymous/18580b1fef1a5c9b8ad87a377baaf07d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import * as types from '../mutation_types' | |
const testModule = { | |
state: { | |
username: null | |
}, | |
actions: { | |
fetchUserInfo ({commit}) { | |
commit(types.PENDING); | |
return new Promise((resolve) => { | |
commit(types.SET_USER, 'Unodepiera'); | |
resolve('Unodepiera'); | |
commit(types.NOT_PENDING); | |
}); | |
} | |
}, | |
mutations: { | |
[types.SET_USER]: (state, response) => { | |
state.username = response; // Unodepiera | |
} | |
}, | |
getters: { | |
username: (state) => { | |
return state.username; | |
} | |
} | |
} | |
export default testModule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment