Files
frontend/marko/page/logs-content/components/remove-log-modal/component.js
T

33 lines
602 B
JavaScript

const {logsApi} = require("../../../../../rpdata/api/Log")
module.exports = class {
onCreate(input) {
this.state = {
error: null,
loading: false,
}
}
open() {
}
close() {
this.emit("close")
}
doIt() {
this.state.loading = true
logsApi.remove({id: this.input.logId}).then(() => {
this.emit("removed")
this.emit("close")
}).catch(errs => {
console.warn("Failed to remove:", errs)
this.state.error = "Failed to remove: " + errs.message || errs[0].message
}).then(() => {
this.state.loading = false
})
}
}