import ngModule from '../module'; import Section from 'salix/components/section'; import UserError from 'core/lib/user-error'; export default class Controller extends Section { onSubmit() { this.getIsAuthorized(); } getIsAuthorized() { this.$http.get(`Workers/${this.$params.id}/authorizeSelfOrSuperior`) .then(res => { this.isAuthorized = res.data; if (!this.isAuthorized) throw new UserError(`You don't have enough privileges`); this.$.watcher.submit(); }); } } ngModule.component('vnUserMailForwarding', { template: require('./index.html'), controller: Controller, require: { card: '^vnUserCard' }, });