nginx-proxy-manager/src/frontend/js/app/nginx/proxy/delete.js
Jamie Curnow c629deb56c WIP
2018-07-18 08:35:49 +10:00

39 lines
1007 B
JavaScript

'use strict';
const Mn = require('backbone.marionette');
const template = require('./delete.ejs');
const Controller = require('../../controller');
const Api = require('../../api');
const App = require('../../main');
require('jquery-serializejson');
module.exports = Mn.View.extend({
template: template,
className: 'modal-dialog',
ui: {
form: 'form',
buttons: '.modal-footer button',
cancel: 'button.cancel',
save: 'button.save'
},
events: {
'click @ui.save': function (e) {
e.preventDefault();
Api.Nginx.ProxyHosts.delete(this.model.get('id'))
.then(() => {
Controller.showNginxProxy();
App.UI.closeModal();
})
.catch(err => {
alert(err.message);
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
});
}
}
});