Last active
November 2, 2018 17:01
-
-
Save vertcitron/3dea7f0e058dd96e5f56f63c4ac7a793 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** VUEX module for todos management in todolist app **/ | |
export default { | |
namespaced: true, | |
// ----------------------------------------------------------------- | |
state: { | |
// properties to store todos data | |
}, | |
// ----------------------------------------------------------------- | |
getters: { | |
// getters and computed props on the todos data | |
}, | |
// ----------------------------------------------------------------- | |
mutations: { | |
// stuff to set todos data locally | |
}, | |
// ----------------------------------------------------------------- | |
actions: { | |
fetch: context => { | |
// stuf to retrieve all the logged in user's todos from backend | |
}, | |
create: (context, todoData) => { | |
// stuff to create a new todo on the backend : CRUD CREATE ACTION | |
}, | |
read: (context, id) => { | |
// stuff to retrieve a particular todo data from the backend : CRUD READ ACTION | |
}, | |
update: (context, todoData) => { | |
// stuff to update a particular todo data to the backend : CRUD UPDATE ACTION | |
}, | |
delete: (context, id) => { | |
// stuff to erase a particular todo on the bockend : CRUD DELETE ACTION | |
} | |
} | |
} |
This file contains hidden or 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
/** VUEX module for user management in todolist app **/ | |
export default { | |
namespaced: true, | |
// ----------------------------------------------------------------- | |
state: { | |
// properties to store user data | |
}, | |
// ----------------------------------------------------------------- | |
getters: { | |
// getters and computed props on the user data | |
}, | |
// ----------------------------------------------------------------- | |
mutations: { | |
// stuff to set user data locally | |
}, | |
// ----------------------------------------------------------------- | |
actions: { | |
create: (context, userData) => { | |
// stuff to create a new user on the backend : CRUD CREATE ACTION | |
}, | |
read: context => { | |
// stuff to retrieve user data from the backend : CRUD READ ACTION | |
}, | |
update: (context, userData) => { | |
// stuff to update user data to the backend : CRUD UPDATE ACTION | |
}, | |
delete: context => { | |
// stuff to erase user on the bockend : CRUD DELETE ACTION | |
}, | |
login: (context, credentials) => { | |
// stuff to log in a user : LOGIN ACTION | |
}, | |
logout: context => { | |
// stuff to logout the logged in user : LOGOUT ACTION | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment