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

Commit

Permalink
feat(xdsl): add both orderMeeting and searchOrderMeetings actions (#302)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie Moallic <[email protected]>
  • Loading branch information
Steffy29 authored Aug 6, 2020
1 parent 6309ed9 commit f090e72
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions src/api/xdsl/xdsl.v6.service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXdsl, OvhApiTelecomSidebar) => {
angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXdsl, OvhApiTelecomSidebar, Poller) => {
const interceptor = {
response(response) {
OvhApiTelecomSidebar.resetCache();
Expand All @@ -7,9 +7,10 @@ angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXds
},
};

return $resource(
const xdsl = $resource(
'/xdsl/:xdslId', {
xdslId: '@id',
serviceName: '@serviceName',
}, {
query: {
method: 'GET',
Expand Down Expand Up @@ -82,6 +83,38 @@ angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXds
method: 'POST',
url: '/xdsl/:xdslId/applyTemplateToModem',
},
orderMeeting: {
method: 'POST',
url: '/xdsl/:serviceName/orderMeeting',
interceptor,
},
},
);

xdsl.searchOrderMeetings = function ($scope, opts) {
const url = `/xdsl/${opts.serviceName}/searchOrderMeetings`;

$scope.$on('$destroy', () => {
Poller.kill({
scope: $scope.$id,
});
});

return Poller.poll(
url,
null,
{
successRule: {
status(elem) {
return elem.status === 'error' || elem.status === 'ok';
},
},
scope: $scope.$id,
method: 'POST',
retryMaxAttempts: 3,
},
);
};

return xdsl;
});

0 comments on commit f090e72

Please sign in to comment.