Skip to content

Instantly share code, notes, and snippets.

@dvallin
Created November 29, 2017 16:46
Show Gist options
  • Save dvallin/20051d4c07188925208067b8ae4f84f8 to your computer and use it in GitHub Desktop.
Save dvallin/20051d4c07188925208067b8ae4f84f8 to your computer and use it in GitHub Desktop.
async [Actions.AddTask] ({getters, commit}, {title}: AddTask) {
try {
const foundTask = getters.taskByTitle(title);
if(_.isNil(foundTask)) {
const task = await TasksApi.addTask(title);
commit({ type: Mutations.AddTaskSucceeded, task });
}
} catch(error) {
commit({type: Mutations.AddTaskFailed, title });
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment