mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-12 13:33:46 +08:00
09c6a3c240
- Updates old components to newer format, removes legacy component support. - Makes component registration easier and less duplicated. - Adds base component class to extend for better editor support. - Aligns global window exposure usage and aligns with other service names.
27 lines
810 B
JavaScript
27 lines
810 B
JavaScript
import {onSelect} from "../services/dom";
|
|
import {Component} from "./component";
|
|
|
|
export class AjaxDeleteRow extends Component {
|
|
setup() {
|
|
this.row = this.$el;
|
|
this.url = this.$opts.url;
|
|
this.deleteButtons = this.$manyRefs.delete;
|
|
|
|
onSelect(this.deleteButtons, this.runDelete.bind(this));
|
|
}
|
|
|
|
runDelete() {
|
|
this.row.style.opacity = '0.7';
|
|
this.row.style.pointerEvents = 'none';
|
|
|
|
window.$http.delete(this.url).then(resp => {
|
|
if (typeof resp.data === 'object' && resp.data.message) {
|
|
window.$events.emit('success', resp.data.message);
|
|
}
|
|
this.row.remove();
|
|
}).catch(err => {
|
|
this.row.style.opacity = null;
|
|
this.row.style.pointerEvents = null;
|
|
});
|
|
}
|
|
} |