mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2025-01-25 11:27:01 +00:00
parent
0c5bc518ee
commit
c2c98ac638
2 changed files with 15 additions and 11 deletions
|
@ -200,9 +200,15 @@ export class Search extends Component<any, SearchState> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// This can be single or multiple communities given
|
// This can be single or multiple communities given
|
||||||
this.state.communities = communitiesRes
|
communitiesRes.match({
|
||||||
.map(c => c.communities)
|
some: res => (this.state.communities = res.communities),
|
||||||
.unwrapOr([communityRes.map(c => c.community_view).unwrap()]);
|
none: void 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
communityRes.match({
|
||||||
|
some: res => (this.state.communities = [res.community_view]),
|
||||||
|
none: void 0,
|
||||||
|
});
|
||||||
|
|
||||||
this.state.creatorDetails = Some(
|
this.state.creatorDetails = Some(
|
||||||
this.isoData.routeData[2] as GetPersonDetailsResponse
|
this.isoData.routeData[2] as GetPersonDetailsResponse
|
||||||
|
@ -819,8 +825,6 @@ export class Search extends Component<any, SearchState> {
|
||||||
let creator_id: Option<number> =
|
let creator_id: Option<number> =
|
||||||
this.state.creatorId == 0 ? None : Some(this.state.creatorId);
|
this.state.creatorId == 0 ? None : Some(this.state.creatorId);
|
||||||
|
|
||||||
console.log(community_id.unwrapOr(-22));
|
|
||||||
|
|
||||||
let form = new SearchForm({
|
let form = new SearchForm({
|
||||||
q: this.state.q,
|
q: this.state.q,
|
||||||
community_id,
|
community_id,
|
||||||
|
|
|
@ -365,9 +365,9 @@ export function routeSearchTypeToEnum(type: string): SearchType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSiteMetadata(url: string) {
|
export async function getSiteMetadata(url: string) {
|
||||||
let form: GetSiteMetadata = {
|
let form = new GetSiteMetadata({
|
||||||
url,
|
url,
|
||||||
};
|
});
|
||||||
let client = new LemmyHttp(httpBase);
|
let client = new LemmyHttp(httpBase);
|
||||||
return client.getSiteMetadata(form);
|
return client.getSiteMetadata(form);
|
||||||
}
|
}
|
||||||
|
@ -1314,7 +1314,7 @@ export function personToChoice(pvs: PersonViewSafe): ChoicesValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchCommunities(q: string) {
|
export async function fetchCommunities(q: string) {
|
||||||
let form: Search = {
|
let form = new Search({
|
||||||
q,
|
q,
|
||||||
type_: Some(SearchType.Communities),
|
type_: Some(SearchType.Communities),
|
||||||
sort: Some(SortType.TopAll),
|
sort: Some(SortType.TopAll),
|
||||||
|
@ -1325,13 +1325,13 @@ export async function fetchCommunities(q: string) {
|
||||||
community_name: None,
|
community_name: None,
|
||||||
creator_id: None,
|
creator_id: None,
|
||||||
auth: auth(false).ok(),
|
auth: auth(false).ok(),
|
||||||
};
|
});
|
||||||
let client = new LemmyHttp(httpBase);
|
let client = new LemmyHttp(httpBase);
|
||||||
return client.search(form);
|
return client.search(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchUsers(q: string) {
|
export async function fetchUsers(q: string) {
|
||||||
let form: Search = {
|
let form = new Search({
|
||||||
q,
|
q,
|
||||||
type_: Some(SearchType.Users),
|
type_: Some(SearchType.Users),
|
||||||
sort: Some(SortType.TopAll),
|
sort: Some(SortType.TopAll),
|
||||||
|
@ -1342,7 +1342,7 @@ export async function fetchUsers(q: string) {
|
||||||
community_name: None,
|
community_name: None,
|
||||||
creator_id: None,
|
creator_id: None,
|
||||||
auth: auth(false).ok(),
|
auth: auth(false).ok(),
|
||||||
};
|
});
|
||||||
let client = new LemmyHttp(httpBase);
|
let client = new LemmyHttp(httpBase);
|
||||||
return client.search(form);
|
return client.search(form);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue