2020-05-14 04:23:41 +08:00
|
|
|
import I18n from "I18n";
|
2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-06-15 23:03:24 +08:00
|
|
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2019-11-28 06:44:01 +08:00
|
|
|
export default Component.extend({
|
|
|
|
classNames: ["watched-word"],
|
|
|
|
watchedWord: null,
|
|
|
|
xIcon: iconHTML("times").htmlSafe(),
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2019-11-28 06:44:01 +08:00
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
2019-11-28 07:44:34 +08:00
|
|
|
this.set("watchedWord", this.get("word.word"));
|
2019-11-28 06:44:01 +08:00
|
|
|
},
|
2017-06-29 04:56:44 +08:00
|
|
|
|
2019-11-28 06:44:01 +08:00
|
|
|
click() {
|
|
|
|
this.word
|
|
|
|
.destroy()
|
|
|
|
.then(() => {
|
|
|
|
this.action(this.word);
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
bootbox.alert(
|
|
|
|
I18n.t("generic_error_with_reason", {
|
|
|
|
error: `http: ${e.status} - ${e.body}`
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|