Move interceptor to common interceptors files

This commit is contained in:
Filipa Lacerda 2017-02-05 17:36:52 +00:00
parent d5a223bdec
commit daf5edf7ba
1 changed files with 8 additions and 0 deletions

View File

@ -13,3 +13,11 @@ Vue.http.interceptors.push((request, next) => {
Vue.activeResources--;
});
});
Vue.http.interceptors.push((request, next) => {
// needed in order to not break the tests.
if ($.rails) {
request.headers['X-CSRF-Token'] = $.rails.csrfToken();
}
next();
});