const {commentApi} = require("../../../../../rpdata/api/Comment") module.exports = class { onCreate(input) { this.state = { error: null, loading: false, values: { title: "", source: "", fictionalDate: "", }, } } change(key, ev) { this.state.values[key] = ev.target.value } close() { this.emit("close") } doIt() { commentApi.removeComment({commentId: this.input.comment.id}).then(() => { this.emit("remove") this.emit("close") }).catch(errs => { console.warn("Failed to delete:", errs) this.state.error = "Failed to delete: " + errs.message || errs[0].message }).then(() => { this.state.loading = false }) } }