Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/bootstrap.js
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if (to.matched.some(route => route.meta.requiresAuth) && !store.state.isLoggedIn) { | ||||
next({ name: 'login' }) | next({ name: 'login' }) | ||||
return | return | ||||
} | } | ||||
next() | next() | ||||
}) | }) | ||||
router.afterEach((to, from) => { | |||||
// When changing a page remove old: | |||||
// - error page | |||||
// - modal backdrop | |||||
$('#error-page,.modal-backdrop.show').remove() | |||||
}) | |||||
/** | /** | ||||
* We'll load the axios HTTP library which allows us to easily issue requests | * We'll load the axios HTTP library which allows us to easily issue requests | ||||
* to our Laravel back-end. This library automatically handles sending the | * to our Laravel back-end. This library automatically handles sending the | ||||
* CSRF token as a header based on the value of the "XSRF" token cookie. | * CSRF token as a header based on the value of the "XSRF" token cookie. | ||||
*/ | */ | ||||
window.axios = require('axios') | window.axios = require('axios') | ||||
axios.defaults.baseURL = vueRouterBase | axios.defaults.baseURL = vueRouterBase | ||||
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' | axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' |