You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
764 B
42 lines
764 B
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
|
|
})
|
|
}
|
|
}
|