export const state = () => ({
data: {}
})
export const getters = {
data: state => state.data
}
export const actions = {
getData ({ commit }) {
this.$axios('https://jsonplaceholder.typicode.com/todosx/1')
.then((response) => {
commit('SET_DATA', response.data)
})
.catch((err) => {
// Navigate to error page
})
}
}
export const mutations = {
SET_DATA (state, data) {
state.data = data
}
}
After catching error in the catch for the axios would like to navigate to the error page from the Nuxt store. What will be the best way to achieve this?