The frontend/UI server, written in JS using the MarkoJS library
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.

41 lines
764 B

  1. const moment = require("moment")
  2. const {charactersApi} = require("../../../../../rpdata/api/Character")
  3. module.exports = class {
  4. onCreate(input) {
  5. this.state = {
  6. error: null,
  7. loading: false,
  8. }
  9. }
  10. change(key, ev) {
  11. this.state.values[key] = ev.target.value
  12. }
  13. open() {
  14. }
  15. close() {
  16. this.emit("close")
  17. }
  18. doIt() {
  19. if (this.state.loading) {
  20. return
  21. }
  22. this.state.loading = true
  23. charactersApi.remove({id: this.input.character.id}).then(() => {
  24. this.emit("removed")
  25. this.emit("close")
  26. }).catch(errs => {
  27. console.warn("Failed to delete:", errs)
  28. this.state.error = "Failed to delete: " + errs[0].message
  29. }).then(() => {
  30. this.state.loading = false
  31. })
  32. }
  33. }