const actions = {
GET_TODO: ({commit}) => {
return axios.get('/api/todo/')
.then(response => {
commit('GET_TODO', response.data)
})
.catch(error => {
console.log(error)
})
},
ADD_TODO: ({commit}, data) => {
return axios.post('/api/todo/', data)
.then(response => {
commit('ADD_TODO', data)
//commit('GET_TODO')
})
.catch(error => {
console.log(error)
})
},
DELETE_ONE_TODO: ({commit}, data) => {
return axios.delete('/api/todo/' + data + '/')
.then(response => {
commit('DELETE_ONE_TODO', data)
})
}
}
async add_todo() {
await this.$store.dispatch('ADD_TODO', {
name: this.new_todo,
user: this.profile.pk,
complete: this.complete
});
this.new_todo = ''
await this.$store.dispatch('GET_TODO')
}
window.jQuery = window.$ = require('jquery');
require('bootstrap/js/dist/modal');