mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-09 18:05:09 +00:00
A few more promises.
This commit is contained in:
parent
9848384f5d
commit
7cd18081f6
|
@ -782,9 +782,18 @@ export class Settings extends Component<any, SettingsState> {
|
|||
this.blockPersonChoices.passedElement.element.addEventListener(
|
||||
"search",
|
||||
debounce(async (e: any) => {
|
||||
let persons = (await fetchUsers(e.detail.value)).users;
|
||||
let choices = persons.map(pvs => personToChoice(pvs));
|
||||
this.blockPersonChoices.setChoices(choices, "value", "label", true);
|
||||
try {
|
||||
let persons = (await fetchUsers(e.detail.value)).users;
|
||||
let choices = persons.map(pvs => personToChoice(pvs));
|
||||
this.blockPersonChoices.setChoices(
|
||||
choices,
|
||||
"value",
|
||||
"label",
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}, 400),
|
||||
false
|
||||
);
|
||||
|
@ -807,15 +816,19 @@ export class Settings extends Component<any, SettingsState> {
|
|||
this.blockCommunityChoices.passedElement.element.addEventListener(
|
||||
"search",
|
||||
debounce(async (e: any) => {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
let choices = communities.map(cv => communityToChoice(cv));
|
||||
this.blockCommunityChoices.setChoices(
|
||||
choices,
|
||||
"value",
|
||||
"label",
|
||||
true
|
||||
);
|
||||
try {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
let choices = communities.map(cv => communityToChoice(cv));
|
||||
this.blockCommunityChoices.setChoices(
|
||||
choices,
|
||||
"value",
|
||||
"label",
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}, 400),
|
||||
false
|
||||
);
|
||||
|
|
|
@ -586,14 +586,18 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
|||
this.choices.passedElement.element.addEventListener(
|
||||
"search",
|
||||
debounce(async (e: any) => {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
this.choices.setChoices(
|
||||
communities.map(cv => communityToChoice(cv)),
|
||||
"value",
|
||||
"label",
|
||||
true
|
||||
);
|
||||
try {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
this.choices.setChoices(
|
||||
communities.map(cv => communityToChoice(cv)),
|
||||
"value",
|
||||
"label",
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}, 400),
|
||||
false
|
||||
);
|
||||
|
|
|
@ -778,11 +778,15 @@ export class Search extends Component<any, SearchState> {
|
|||
this.communityChoices.passedElement.element.addEventListener(
|
||||
"search",
|
||||
debounce(async (e: any) => {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
let choices = communities.map(cv => communityToChoice(cv));
|
||||
choices.unshift({ value: "0", label: i18n.t("all") });
|
||||
this.communityChoices.setChoices(choices, "value", "label", true);
|
||||
try {
|
||||
let communities = (await fetchCommunities(e.detail.value))
|
||||
.communities;
|
||||
let choices = communities.map(cv => communityToChoice(cv));
|
||||
choices.unshift({ value: "0", label: i18n.t("all") });
|
||||
this.communityChoices.setChoices(choices, "value", "label", true);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}, 400),
|
||||
false
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue