All Dogparks in Denmark - REST/API via Laravel. The project is based on my old project: hundeskove.dk (which I don't own or maintain anymore)

Hundeskoven.dk is a new project I've been working on just for practicing Vue & Laravel API: Β Vue.js for frontend mixed with Vuex + Vue-router.

In order to write less code I'm using Vue Api Query and QueryBuilder from Spatie. Which works great with Laravel Framework.

This is just a small piece of my code from Vuex main store. I am storing departments so they can be used in all my Vue components. Β 

/*
* Vuex store
*/
export default { 
    state: {
        list_departments: []
    },
    getters: {
        getDepartments(state) {
            return state.list_departments
        },
    },
    actions: {
        async allDepartments(context){
            await axios.get("API/V1/getAlldepartments").then((response)=>{
                context.commit("list_departments",response.data.data)
            }) 
        }
    },
    mutations: {
        list_departments(state,data) {
            return state.list_departments = data
        }
    }
}


ListDepartments component to get all departments like below:

export default {
    name: "ListDepartments",
    mounted() {
      this.$store.dispatch('allDepartments')
    },
    computed: {
      allDepartments(){
        return this.$store.getters.getDepartments
      }
    }
}


Checkout project: www.hundeskoven.dk