ideasfera
127
2
Vue

Vue.js and axios: best way to emit events

Posted 1 month ago by ideasfera

Don't know why, but when I emit an event inside and outside an axios promise only the event inside is emitted for real.

example:


            events.$emit('loadingDataStarted')
            axios.get(url)
                .then(({ data }) => {
            ...
                    events.$emit('loadingDataEnded')
                })


Only the loadingDataEnded is emitted but not the loadingDataStarted

Please sign in or create an account to participate in this conversation.