salix/modules/account/front/card/index.js

33 lines
878 B
JavaScript

import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';
import './style.scss';
class Controller extends ModuleCard {
reload() {
const filter = {
where: {id: this.$params.id},
include: {
relation: 'role',
scope: {
fields: ['id', 'name']
}
}
};
return Promise.all([
this.$http.get(`VnUsers/preview`, {filter})
.then(res => {
const [user] = res.data;
this.user = user;
}),
this.$http.get(`Accounts/${this.$params.id}/exists`)
.then(res => this.hasAccount = res.data.exists)
]);
}
}
ngModule.vnComponent('vnUserCard', {
template: require('./index.html'),
controller: Controller
});