salix/modules/account/front/alias/users/index.js

32 lines
923 B
JavaScript

import ngModule from '../../module';
import Section from 'salix/components/section';
export default class Controller extends Section {
$onInit() {
let filter = {
include: {
relation: 'user',
scope: {
fields: ['id', 'name']
}
}
};
this.$http.get(`MailAliases/${this.$params.id}/accounts`, {filter})
.then(res => this.$.data = res.data);
}
onRemove(row) {
return this.$http.delete(`MailAliases/${this.$params.id}/accounts/${row.id}`)
.then(() => {
let index = this.$.data.indexOf(row);
if (index !== -1) this.$.data.splice(index, 1);
this.vnApp.showSuccess(this.$t('User removed'));
});
}
}
ngModule.component('vnAliasUsers', {
template: require('./index.html'),
controller: Controller
});