Skip to content

Commit bfbc7f4

Browse files
committed
Added CSRF dummy header within interceptor
1 parent 97af9a8 commit bfbc7f4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/ViewProduct.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454

5555
<script>
5656
export default {
57-
http: {
58-
headers: {
59-
'X-CSRF-TOKEN': 'VERY_SECURE_TOKEN_HERE'
60-
}
61-
},
6257
props: {
6358
productId: {
6459
required: true

src/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ Vue.use(VueResource);
5656
Vue.http.options.root = 'http://localhost:3000';
5757
Vue.http.headers.common['X-Requested-With'] = 'XMLHttpRequest';
5858

59+
Vue.http.interceptors.push((request, next) => {
60+
request.headers.set('X-CSRF-TOKEN', 'VERY_SECURE_TOKEN_HERE');
61+
next((response) => {
62+
console.log(response);
63+
});
64+
});
65+
5966
/* eslint-disable no-new */
6067
new Vue({
6168
el: '#app',

0 commit comments

Comments
 (0)