const moment = require("moment") const {charactersApi} = require("../../../../../rpdata/api/Character") module.exports = class { onCreate(input) { this.state = { error: null, loading: false, } } change(key, ev) { this.state.values[key] = ev.target.value } open() { } close() { this.emit("close") } doIt() { if (this.state.loading) { return } this.state.loading = true charactersApi.remove({id: this.input.character.id}).then(() => { this.emit("removed") this.emit("close") }).catch(errs => { console.warn("Failed to delete:", errs) this.state.error = "Failed to delete: " + errs[0].message }).then(() => { this.state.loading = false }) } }