added search url encoding

This commit is contained in:
Fishandchips321 2026-03-02 18:08:55 +00:00
parent 6a47760cbf
commit cdbfb8c185
3 changed files with 7 additions and 2 deletions

View file

@ -9,6 +9,9 @@ const ServerList = () => {
useEffect(() => {
getServerList().then(serverList => {
setServers(serverList);
}).catch(err => {
setServers([]);
alert(err);
})
}, []);

View file

@ -11,7 +11,7 @@ export interface SearchResult {
}
export const search = async (searchTerm: string, serverId: string): Promise<Array<SearchResult>> => {
const response = await axios.get<Array<SearchResult>>(`${apiUrl}/search?searchTerm=${searchTerm}&serverId=${serverId}`);
const response = await axios.get<Array<SearchResult>>(encodeURI(`${apiUrl}/search?searchTerm=${searchTerm}&serverId=${serverId}`));
return response.data;
}