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

Commit

Permalink
fix(order.cartServiceOption): duplicate service name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisay committed Jan 22, 2019
1 parent 9e58589 commit b24f407
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @deprecated
* Use order/cartServiceOptions/cartServiceOptions.service.js instead
* as this service is overrided by the same name in this file.
*/
angular.module("ovh-api-services").service("OvhApiOrderCartServiceOption", function ($injector) {

"use strict";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @deprecated
* Use order/cartServiceOptions/cartServiceOptions.service.v6.js instead
* as this service is not reachable as there is a duplicate of the OvhApiOrderCartServiceOption service.
*/
angular.module("ovh-api-services").service("OvhApiOrderCartServiceOptionV6", function ($resource, $cacheFactory) {

"use strict";
Expand Down
3 changes: 3 additions & 0 deletions src/order/cartServiceOption/cartServiceOption.service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
angular.module("ovh-api-services").service("OvhApiOrderCartServiceOption", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiOrderCartServiceOptionV6");
},
Microsoft: function () {
return $injector.get("OvhApiOrderCartServiceOptionMicrosoft");
},
Expand Down
33 changes: 33 additions & 0 deletions src/order/cartServiceOption/cartServiceOption.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
angular.module("ovh-api-services").service("OvhApiOrderCartServiceOptionV6", function ($resource, $cacheFactory) {

"use strict";

// Cache to invalidate
var queryCache = $cacheFactory("OvhApiOrderCartServiceOptionV6Query");
var cache = $cacheFactory("OvhApiOrderCartServiceOptionV6");

var interceptor = {
response: function (response) {
orderCartServiceOption.resetQueryCache();
return response.data;
}
};

var orderCartServiceOption = $resource("/order/cartServiceOption/:productName/:serviceName", {
productName: "@productName",
serviceName: "@serviceName"
}, {
get: { method: "GET", cache: cache, isArray: true },
post: { method: "POST", interceptor: interceptor }
});

orderCartServiceOption.resetCache = function () {
cache.removeAll();
};

orderCartServiceOption.resetQueryCache = function () {
queryCache.removeAll();
};

return orderCartServiceOption;
});

0 comments on commit b24f407

Please sign in to comment.