nuxt middleware code example
Example 1: nuxt axios middleware
export default function ({ $axios, redirect }) {
$axios.onError(error => {
if(error.response.status === 500) {
redirect('/sorry')
}
})
}
Example 2: nuxt typescript middleware property
@Component({
components: {
Logo
},
middleware: ['typescript']
})
class Index extends Vue {}