[Vuejs]-VUEX: Unexpected token, expected "," (axios)

1👍

use your IDE. You clearly don’t open and close your braces and parentheses in the right order. If you click over a closing brace/parentheses in most editors (including even google chrome JS console which is what i used to find this) it will highlight the opening one making it very quick and easy to find your syntax errors…

actions: {
    currentCity({commit})
    {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(position => {
                axios
                    .get(`${this.url_base}weather?&lat=${position.coords.latitude}&lon=${position.coords.longitude}&units=metric&APPID=${this.api_key}`)
                    .then(res => res.data)
                    .then(weather => {
                        commit('currentCity', weather)
                    })
            })
        }
    }
}

Leave a comment