Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/app.js
/** | /** | ||||
* First we will load all of this project's JavaScript dependencies which | * First we will load all of this project's JavaScript dependencies which | ||||
* includes Vue and other libraries. It is a great starting point when | * includes Vue and other libraries. It is a great starting point when | ||||
* building robust, powerful web applications using Vue and Laravel. | * building robust, powerful web applications using Vue and Laravel. | ||||
*/ | */ | ||||
require('./bootstrap') | require('./bootstrap') | ||||
window.Vue = require('vue') | window.Vue = require('vue') | ||||
import AppComponent from '../vue/components/App' | import AppComponent from '../vue/components/App' | ||||
import MenuComponent from '../vue/components/Menu' | import MenuComponent from '../vue/components/Menu' | ||||
import router from '../vue/js/routes.js' | import router from '../vue/js/routes.js' | ||||
import store from '../vue/js/store' | import store from '../vue/js/store' | ||||
import FontAwesomeIcon from './fontawesome.js' | |||||
import VueToastr from '@deveodk/vue-toastr' | import VueToastr from '@deveodk/vue-toastr' | ||||
Vue.component('svg-icon', FontAwesomeIcon) | |||||
Vue.use(VueToastr, { | |||||
defaultPosition: 'toast-bottom-right', | |||||
defaultTimeout: 5000 | |||||
}) | |||||
// Add a response interceptor for general/validation error handler | // Add a response interceptor for general/validation error handler | ||||
// This have to be before Vue and Router setup. Otherwise we would | // This have to be before Vue and Router setup. Otherwise we would | ||||
// not be able to handle axios responses initiated from inside | // not be able to handle axios responses initiated from inside | ||||
// components created/mounted handlers (e.g. signup code verification link) | // components created/mounted handlers (e.g. signup code verification link) | ||||
window.axios.interceptors.response.use( | window.axios.interceptors.response.use( | ||||
response => { | response => { | ||||
// Do nothing | // Do nothing | ||||
return response | return response | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | methods: { | ||||
if (error.response.status === 401) { | if (error.response.status === 401) { | ||||
this.logoutUser() | this.logoutUser() | ||||
} else { | } else { | ||||
this.errorPage(error.response.status, error.response.statusText) | this.errorPage(error.response.status, error.response.statusText) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}) | }) | ||||
Vue.use(VueToastr, { | |||||
defaultPosition: 'toast-bottom-right', | |||||
defaultTimeout: 5000 | |||||
}) |