Difference in $ http response and Api response [AngularJs]

I have a problem with my application where I receive an API request from members that belong to a separate group.

GET /api/organizations/1234/members?group=4321

      

If I start my navigation with this request, I have the correct members, but if I navigate to another page with a different group earlier, the $ http response will be populated by the parasite members, whereas the response form API is correct (check from the network tab in development tools Chrome).

I am thinking of some cache but I cannot find it! For information, I'm using jsData to set my data, but that doesn't seem to be the problem.

Here's the code for my function to send the Api Request:

var loadGroupMembers = function() {
 return $q(function(resolve, reject) {
   var callParams = {
     organizationId: $stateParams.OrganizationId,
     groupId: $stateParams.groupId
   };

   sendApiCall('groupMembers', 'get', callParams)
     .success(function(data) {
      resolve(data);
    })
    .error(function(data) {
    });
 });
};

var sendApiCall = function(requestId, method, params, data, queryStringParams) {
  params = params || {};
  data = data || {};

  var apiCallConfig = {
    params: config.params,
    method: config.method,
    url: "/api/organizations/1234/members?group=4321",
    data: data,
    cache : false
  };

  $rootScope.fn.setHistory($state.current.name, 'apiCall', 'sendManualApiCall:' + requestId);
  return $http(apiCallConfig);
};

      

Please tell me if you have questions or need more information. Thank you for your help!:)

Edit: I add a function that calls sendApiCall and I made a little api to show you how the data is from the api: http://private-52326-groupmember.apiary-mock.com/organization/1234/members?group=4321

+3


source to share


1 answer


It was some kind of connection to Jsdata and an interceptor created by another developer. For every api request, the interceptor adds some response data with the same type ... So the issue is closed. Thanks for your help anyway :)



0


source







All Articles