blob: 283e90d28f88061717d69826f17a74c1404e13e5 [file] [log] [blame]
Matteo Scandolo889ced32015-11-04 16:07:09 +01001(function() {
2 'use strict';
3
4 angular
5 .module('xos.helpers')
6 .factory('SetCSRFToken', setCSRFToken);
7
Matteo Scandolod3de3902015-11-25 12:08:41 -08008 function setCSRFToken($cookies) {
Matteo Scandolo889ced32015-11-04 16:07:09 +01009 return {
10 request: function(request){
11 if(request.method !== 'GET'){
12 request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
13 }
14 return request;
15 }
16 };
17 }
Matteo Scandolod3de3902015-11-25 12:08:41 -080018})();