Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
chore(cache): refactor use of cache for click2call services, plus res…
Browse files Browse the repository at this point in the history
…etCache method created
  • Loading branch information
Jérémy DE CESARE committed Jan 18, 2018
1 parent a4ad939 commit 21a9118
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
18 changes: 10 additions & 8 deletions dist/ovh-api-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -12501,14 +12501,12 @@ angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2Call", ["$i
};
}]);

angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLexi", ["$resource", "$cacheFactory", function ($resource, $cacheFactory) {
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLexi", ["$resource", "$cacheFactory", "OvhApiTelephonyLineClick2CallUser", function ($resource, $cacheFactory, OvhApiTelephonyLineClick2CallUser) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonyLineClick2CallUserLexi");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
OvhApiTelephonyLineClick2CallUser.cache.remove(response.config.url);
return response.data;
}
};
Expand All @@ -12521,15 +12519,15 @@ angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLex
query: {
method: "GET",
isArray: true,
cache: cache
cache: OvhApiTelephonyLineClick2CallUser.cache
},
post: {
method: "POST",
interceptor: interceptor
},
get: {
method: "GET",
cache: cache,
cache: OvhApiTelephonyLineClick2CallUser.cache,
isArray: false
},
"delete": {
Expand Down Expand Up @@ -12559,13 +12557,17 @@ angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLex
});
}]);

angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUser", ["$injector", function ($injector) {
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUser", ["$cacheFactory", "$injector", function ($cacheFactory, $injector) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonyLineClick2CallUser");
return {
Lexi: function () {
return $injector.get("OvhApiTelephonyLineClick2CallUserLexi");
},
Aapi: angular.noop
Aapi: angular.noop,
resetCache: cache.removeAll,
cache: cache
};
}]);

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLexi", function ($resource, $cacheFactory) {
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLexi", ["$resource", "$cacheFactory", "OvhApiTelephonyLineClick2CallUser", function ($resource, $cacheFactory, OvhApiTelephonyLineClick2CallUser) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonyLineClick2CallUserLexi");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
OvhApiTelephonyLineClick2CallUser.cache.remove(response.config.url);
return response.data;
}
};
Expand All @@ -18,15 +16,15 @@ angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLex
query: {
method: "GET",
isArray: true,
cache: cache
cache: OvhApiTelephonyLineClick2CallUser.cache
},
post: {
method: "POST",
interceptor: interceptor
},
get: {
method: "GET",
cache: cache,
cache: OvhApiTelephonyLineClick2CallUser.cache,
isArray: false
},
"delete": {
Expand Down Expand Up @@ -54,4 +52,4 @@ angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUserLex
interceptor: interceptor
}
});
});
}]);
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUser", function ($injector) {
angular.module("ovh-api-services").service("OvhApiTelephonyLineClick2CallUser", ["$cacheFactory", "$injector", function ($cacheFactory, $injector) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonyLineClick2CallUser");
return {
Lexi: function () {
return $injector.get("OvhApiTelephonyLineClick2CallUserLexi");
},
Aapi: angular.noop
Aapi: angular.noop,
resetCache: cache.removeAll,
cache: cache
};
});
}]);

0 comments on commit 21a9118

Please sign in to comment.