30 lines
674 B
JavaScript
30 lines
674 B
JavaScript
'use strict';
|
|
|
|
const views = require('../util/views.js');
|
|
|
|
class UserDeleteView {
|
|
constructor() {
|
|
this.template = views.getTemplate('user-delete');
|
|
}
|
|
|
|
render(ctx) {
|
|
const target = ctx.target;
|
|
const source = this.template(ctx);
|
|
|
|
const form = source.querySelector('form');
|
|
|
|
views.decorateValidator(form);
|
|
|
|
form.addEventListener('submit', e => {
|
|
e.preventDefault();
|
|
views.clearMessages(target);
|
|
views.disableForm(form);
|
|
ctx.delete();
|
|
});
|
|
|
|
views.listenToMessages(target);
|
|
views.showView(target, source);
|
|
}
|
|
}
|
|
|
|
module.exports = UserDeleteView;
|