Todo List Vue with Vuex

project view

Screenshot 2021-05-25 at 12 15 56 PM

vueX everything in 3 photo

Screenshot 2021-05-13 at 12 20 40 AM

Screenshot 2021-05-13 at 12 20 31 AM

Screenshot 2021-05-13 at 12 20 21 AM

Screenshot 2021-05-17 at 12 27 17 PM

another way to call getters & action , without mapAction,mapGetter,mapMutation

Screenshot 2021-05-25 at 2 28 34 PM Screenshot 2021-05-25 at 2 29 03 PM

      this.$store.dispatch('updatedTodo',updTodo)
      
      deleteTodo(id){
        this.$store.dispatch('deleteTodo',id)
      }
    
     getAllTodos(){
        return this.$store.getters['allTodos']
     }
    
    this.$store.dispatch('fetchTodos');

here is full file for call vuex without map function

<template>
  <div>
    <h4></h4>
    <AddTodo />
    <FilterTodos />

    <div class="legend">
      <span>Double click to mark as complete</span>
      <span> <span class="incomplete-box"></span> = Incomplete </span>
      <span> <span class="complete-box"></span> = complete </span>
    </div>
    <div class="todos">
      <div
        class="todo"
        v-for="todo in getAllTodos"
        :key="todo.id"
        @dblclick="onDblClick(todo)"
        :class="{'is-complete': todo.completed}"
      >
        {{ todo.title }}

        <i @click="deleteTodo(todo.id)" class="fas fa-trash-alt"></i>
      </div>
    </div>
  </div>
</template>

<script>
import AddTodo from "./AddTodo";
import FilterTodos from "./FilterTodos";
export default {
  name: "Todo",
  components:{
    AddTodo,
    FilterTodos

  },
  methods: {
    onDblClick(todo) {
      const updTodo = {
        id: todo.id,
        title: todo.title,
        completed: !todo.completed,
      };

      this.$store.dispatch('updatedTodo',updTodo)
    },
    check() {
      console.log("this is action check from component");
    },
    deleteTodo(id){
      this.$store.dispatch('deleteTodo',id)
    }

  },
  computed: {
    getAllTodos(){
      return this.$store.getters['allTodos']
    }

  },//mapGetters(["allTodos"]),//this.$store.getters['allTodos'],//
  created() {
    // this.testAction();
    // this.fetchTodos();
    this.$store.dispatch('fetchTodos');
    console.log("when load finish then call ");
  },
};
</script>

vue-router

Screenshot 2021-05-18 at 10 57 32 AM

Screenshot 2021-05-18 at 10 58 57 AM