Eugen Rochko c40016b785 [Glitch] Change search to use query params in web UI
Port 0636bcdbe1ddbd648b1bc1c26f9ee897a816306a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-12-25 21:38:02 +01:00

22 lines
638 B
TypeScript

import type { ApiSearchResultsJSON } from 'flavours/glitch/api_types/search';
import type { ApiHashtagJSON } from 'flavours/glitch/api_types/tags';
export type SearchType = 'account' | 'hashtag' | 'accounts' | 'statuses';
export interface RecentSearch {
q: string;
type?: SearchType;
}
export interface SearchResults {
accounts: string[];
statuses: string[];
hashtags: ApiHashtagJSON[];
}
export const createSearchResults = (serverJSON: ApiSearchResultsJSON) => ({
accounts: serverJSON.accounts.map((account) => account.id),
statuses: serverJSON.statuses.map((status) => status.id),
hashtags: serverJSON.hashtags,
});