Working search

This commit is contained in:
Fishandchips321 2026-02-22 21:58:23 +00:00
parent 271cf1f407
commit 2a572e8bc4
15 changed files with 217 additions and 39 deletions

View file

@ -1,30 +1,21 @@
import axios from "axios";
import type { Server } from "./Servers";
import { apiUrl } from "./api";
export interface SearchResult {
name: string;
id: string;
serverId: string;
type: SearchResultType;
episodes: number;
productionYear: string;
}
export type SearchResultType = "movie" | "tv show" | "music";
export const search = async (searchTerm: string, serverId: string): Promise<Array<SearchResult>> => {
return [{
name: "Test Result",
episodes: 0,
id: "awawa",
serverId: serverId,
type: "movie"
},
{
name: "Test result 2",
episodes: 0,
id: "awawa 2",
serverId: serverId,
type: "movie"
}];
const response = await axios.get<Array<SearchResult>>(`${apiUrl}/search?searchTerm=${searchTerm}&serverId=${serverId}`);
return response.data;
}
export const getUrlForSearchResult = (result: SearchResult, server: Server): string => {