salix/modules/client/front/recovery/index/index.js

26 lines
665 B
JavaScript

import ngModule from '../../module';
class Controller {
constructor($stateParams, $scope, $http) {
this.$stateParams = $stateParams;
this.$scope = $scope;
this.$http = $http;
}
setFinished(recovery) {
if (!recovery.finished) {
let params = {finished: Date.now()};
this.$http.patch(`/client/api/Recoveries/${recovery.id}`, params).then(
() => this.$scope.model.refresh()
);
}
}
}
Controller.$inject = ['$stateParams', '$scope', '$http'];
ngModule.component('vnClientRecoveryIndex', {
template: require('./index.html'),
controller: Controller
});