feat(search): add unified global search for users/chats/messages
Some checks failed
CI / test (push) Failing after 24s
Some checks failed
CI / test (push) Failing after 24s
This commit is contained in:
16
web/src/api/search.ts
Normal file
16
web/src/api/search.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { http } from "./http";
|
||||
import type { DiscoverChat, Message, UserSearchItem } from "../chat/types";
|
||||
|
||||
export interface GlobalSearchResponse {
|
||||
users: UserSearchItem[];
|
||||
chats: DiscoverChat[];
|
||||
messages: Message[];
|
||||
}
|
||||
|
||||
export async function globalSearch(query: string): Promise<GlobalSearchResponse> {
|
||||
const { data } = await http.get<GlobalSearchResponse>("/search", {
|
||||
params: { query, users_limit: 10, chats_limit: 10, messages_limit: 10 }
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user