Here is the deal i want to add auth token and idx to every http request.
when i try i get a TypeError: Cannot set property 'site' of undefined
here is the interceptor
$httpProvider.interceptors.push(function($q, $cookies,$location) {
return {
'request': function(config) {
config.data.auth ='hasAuth';
config.data.token = $cookies.token;
config.data.idx = $cookies.idx;
console.log(config);
return config;
}
};
});
And here is the $http request.
app.controller('coolCtrl', function($scope, $http, makeUrl, $cookies){
var info={};
info = $cookies.eidx;
var test = $http.post("https://example.com/uri/list", info )
.success(function (data) {
$scope.data = data
});
});
And the error
TypeError: Cannot set property 'auth' of undefined
I feel like im getting mixed up in all the promises.
Thanks in advance
-James