Я хочу выйти из системы и перенаправить на страницу входа, когда сервер вернул ошибку 401 в моем приложении Vue, но в консоли я вижу ошибку: «Не удается прочитать свойство 'interceptors' of undefined". Ты хоть представляешь, как это исправить?
import router from './router/router.js'
import Vue from 'vue'
import BootstrapVue from 'bootstrap-vue'
import Vuelidate from 'vuelidate'
Vue.use(BootstrapVue)
Vue.use(Vuelidate)
Vue.http.interceptors.push(function (request, next) {
next(function (response) {
if (response.status === 401) {
let msg = response.body.returnMessage
localStorage.setItem('logoutReason', msg)
}
})
})
const app = new Vue({
el: '#app',
router
});