2020-05-13 16:23:41 -04:00
|
|
|
import I18n from "I18n";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2017-07-26 16:25:09 -04:00
|
|
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2019-11-27 17:44:01 -05:00
|
|
|
export default Component.extend({
|
|
|
|
classNames: ["watched-word"],
|
|
|
|
watchedWord: null,
|
|
|
|
xIcon: iconHTML("times").htmlSafe(),
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2019-11-27 17:44:01 -05:00
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
2019-11-27 18:44:34 -05:00
|
|
|
this.set("watchedWord", this.get("word.word"));
|
2019-11-27 17:44:01 -05:00
|
|
|
},
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2019-11-27 17:44:01 -05: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}`
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|