this.state = this.emptyState;
this.state.registerForm.captcha_answer = undefined;
// Refetch another captcha
- WebSocketService.Instance.send(wsClient.getCaptcha());
+ // WebSocketService.Instance.send(wsClient.getCaptcha());
this.setState(this.state);
return;
} else {
if (
UserService.Instance.myUserInfo &&
data.comment_view.creator.id ==
- UserService.Instance.myUserInfo.local_user_view.person.id
+ UserService.Instance.myUserInfo?.local_user_view.person.id
) {
toast(i18n.t("reply_sent"));
}
}
isBottom(el: Element) {
- return el.getBoundingClientRect().bottom <= window.innerHeight;
+ return el?.getBoundingClientRect().bottom <= window.innerHeight;
}
/**
*/
trackCommentsBoxScrolling = () => {
const wrappedElement = document.getElementsByClassName("comments")[0];
- if (this.isBottom(wrappedElement)) {
+ if (wrappedElement && this.isBottom(wrappedElement)) {
this.state.maxCommentsShown += commentsShownInterval;
this.setState(this.state);
}
this.creatorChoices.passedElement.element.addEventListener(
"search",
debounce(async (e: any) => {
- let creators = (await fetchUsers(e.detail.value)).users;
- let choices = creators.map(pvs => personToChoice(pvs));
- choices.unshift({ value: "0", label: i18n.t("all") });
- this.creatorChoices.setChoices(choices, "value", "label", true);
+ try {
+ let creators = (await fetchUsers(e.detail.value)).users;
+ let choices = creators.map(pvs => personToChoice(pvs));
+ choices.unshift({ value: "0", label: i18n.t("all") });
+ this.creatorChoices.setChoices(choices, "value", "label", true);
+ } catch (err) {
+ console.log(err);
+ }
}, 400),
false
);