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(
|
this.blockPersonChoices.passedElement.element.addEventListener(
|
||||||
"search",
|
"search",
|
||||||
debounce(async (e: any) => {
|
debounce(async (e: any) => {
|
||||||
let persons = (await fetchUsers(e.detail.value)).users;
|
try {
|
||||||
let choices = persons.map(pvs => personToChoice(pvs));
|
let persons = (await fetchUsers(e.detail.value)).users;
|
||||||
this.blockPersonChoices.setChoices(choices, "value", "label", true);
|
let choices = persons.map(pvs => personToChoice(pvs));
|
||||||
|
this.blockPersonChoices.setChoices(
|
||||||
|
choices,
|
||||||
|
"value",
|
||||||
|
"label",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
}, 400),
|
}, 400),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -807,15 +816,19 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
this.blockCommunityChoices.passedElement.element.addEventListener(
|
this.blockCommunityChoices.passedElement.element.addEventListener(
|
||||||
"search",
|
"search",
|
||||||
debounce(async (e: any) => {
|
debounce(async (e: any) => {
|
||||||
let communities = (await fetchCommunities(e.detail.value))
|
try {
|
||||||
.communities;
|
let communities = (await fetchCommunities(e.detail.value))
|
||||||
let choices = communities.map(cv => communityToChoice(cv));
|
.communities;
|
||||||
this.blockCommunityChoices.setChoices(
|
let choices = communities.map(cv => communityToChoice(cv));
|
||||||
choices,
|
this.blockCommunityChoices.setChoices(
|
||||||
"value",
|
choices,
|
||||||
"label",
|
"value",
|
||||||
true
|
"label",
|
||||||
);
|
true
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
}, 400),
|
}, 400),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
@ -586,14 +586,18 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
this.choices.passedElement.element.addEventListener(
|
this.choices.passedElement.element.addEventListener(
|
||||||
"search",
|
"search",
|
||||||
debounce(async (e: any) => {
|
debounce(async (e: any) => {
|
||||||
let communities = (await fetchCommunities(e.detail.value))
|
try {
|
||||||
.communities;
|
let communities = (await fetchCommunities(e.detail.value))
|
||||||
this.choices.setChoices(
|
.communities;
|
||||||
communities.map(cv => communityToChoice(cv)),
|
this.choices.setChoices(
|
||||||
"value",
|
communities.map(cv => communityToChoice(cv)),
|
||||||
"label",
|
"value",
|
||||||
true
|
"label",
|
||||||
);
|
true
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
}, 400),
|
}, 400),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
@ -778,11 +778,15 @@ export class Search extends Component<any, SearchState> {
|
||||||
this.communityChoices.passedElement.element.addEventListener(
|
this.communityChoices.passedElement.element.addEventListener(
|
||||||
"search",
|
"search",
|
||||||
debounce(async (e: any) => {
|
debounce(async (e: any) => {
|
||||||
let communities = (await fetchCommunities(e.detail.value))
|
try {
|
||||||
.communities;
|
let communities = (await fetchCommunities(e.detail.value))
|
||||||
let choices = communities.map(cv => communityToChoice(cv));
|
.communities;
|
||||||
choices.unshift({ value: "0", label: i18n.t("all") });
|
let choices = communities.map(cv => communityToChoice(cv));
|
||||||
this.communityChoices.setChoices(choices, "value", "label", true);
|
choices.unshift({ value: "0", label: i18n.t("all") });
|
||||||
|
this.communityChoices.setChoices(choices, "value", "label", true);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
}, 400),
|
}, 400),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue