Skip to content

Commit

Permalink
fertig....
Browse files Browse the repository at this point in the history
  • Loading branch information
HDenizD committed May 19, 2021
1 parent 6c05c70 commit 04bb00d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 4 additions & 8 deletions src/components/TodoItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
height="40px"
width="40px"
color="error"
@click="deleteHandler(todoData.id)"
@click="deleteHandler(todoData)"
>
<v-icon>mdi-delete-outline</v-icon>
</v-btn>
Expand All @@ -73,20 +73,16 @@ export default {
todoData: {
type: Object,
default: () => {}
},
todoListIndex: {
type: Number,
default: null
}
},
data() {
return {}
},
methods: {
...mapActions(['deleteTodo', 'updateTodo']),
deleteHandler(id) {
async deleteHandler(todoData) {
this.todoData.show = false
this.deleteTodo(this.todoListIndex)
await this.deleteTodo(todoData.id)
},
updateTodoHandler(todo) {
this.updateTodo(todo)
Expand All @@ -108,7 +104,7 @@ export default {
transition: all 0.3s ease;
}
.slide-fade-leave-active {
transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
transition: all 0.4s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter,
.slide-fade-leave-to {
Expand Down
5 changes: 3 additions & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default new Vuex.Store({
state.todos.push(payload)
},
deleteTodo(state, id) {
state.todo.splice(id, 1)
const todoIndex = state.todos.findIndex(todo => todo.id === id)
state.todos.splice(todoIndex, 1)
},
updateRequestBuffer(state, payload) {
state.requestBuffer = payload
Expand All @@ -36,7 +37,7 @@ export default new Vuex.Store({
axios
.get('https://jsonplaceholder.typicode.com/todos')
.then(res => {
const splicedTodos = res.data.splice(0, 3)
const splicedTodos = res.data.splice(0, 10)
for (const todo of splicedTodos) {
todo.show = true
todo.editMode = false
Expand Down

0 comments on commit 04bb00d

Please sign in to comment.