This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xdsl.meetings): add endpoints to retrieve and select meeting
Signed-off-by: Stephanie Moallic <[email protected]>
- Loading branch information
Stephanie Moallic
committed
Aug 4, 2020
1 parent
d37f01d
commit 85fec79
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
angular.module('ovh-api-services').service('OvhApiXdslMeeting', ($injector, $cacheFactory) => { | ||
const cache = $cacheFactory('OvhApiXdslMeeting'); | ||
|
||
return { | ||
v6() { | ||
return $injector.get('OvhApiXdslMeetingV6'); | ||
}, | ||
resetCache: cache.removeAll, | ||
cache, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
angular.module('ovh-api-services').service('OvhApiXdslMeetingV6', ($resource, OvhApiXdslMeeting, Poller) => { | ||
const interceptor = { | ||
response(response) { | ||
OvhApiXdslMeeting.resetCache(); | ||
return response.resource; | ||
}, | ||
}; | ||
|
||
const meeting = $resource('/xdsl/:serviceName/orderMeeting', { | ||
serviceName: '@serviceName', | ||
}, { | ||
orderMeeting: { | ||
method: 'POST', | ||
interceptor, | ||
}, | ||
}); | ||
|
||
meeting.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 meeting; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters