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.

35 lines
739 B

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