Merge branch 'csrf-header' into 'boutique-sable'
add axios csrf header for re7 and production servers See merge request service-web-lab/boutique-cnc-sable!6
This commit is contained in:
commit
932c88b57b
2 changed files with 15 additions and 1 deletions
14
resources/views/front/sable/js/app.js
vendored
14
resources/views/front/sable/js/app.js
vendored
|
|
@ -62,6 +62,20 @@ const store = new Vuex.Store({
|
|||
}
|
||||
});
|
||||
|
||||
const metaCSRFToken = document.querySelector(
|
||||
"meta[name='csrf-token']"
|
||||
)
|
||||
|
||||
if (!metaCSRFToken) {
|
||||
throw new Error("Missing meta CSRF token");
|
||||
}
|
||||
|
||||
Axios.defaults.headers.common = {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"X-CSRF-TOKEN": metaCSRFToken.getAttribute("content"),
|
||||
};
|
||||
|
||||
window.axios = Axios;
|
||||
|
||||
const app = new Vue({
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<link rel="canonical" href="{{ url()->current() }}" />
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset(config('app.theme') . '/css/app.css') }}" rel="stylesheet">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue