Only search when query has length

This commit is contained in:
2022-08-14 23:44:52 +02:00
parent 3a58e77da0
commit 5f942848aa
2 changed files with 4 additions and 3 deletions

View File

@@ -61,8 +61,9 @@
}
function fetchTorrents() {
loading.value = true;
if (!props.query?.length) return;
loading.value = true;
searchTorrents(props.query)
.then(torrentResponse => setTorrents(torrentResponse?.results))
.then(() => updateResultCountDisplay())

View File

@@ -82,9 +82,9 @@ export function humanMinutes(minutes) {
return `${hours}h ${minutesLeft}m`;
}
export function getValueFromUrlQuery(queryParameter: string): string | null {
export function getValueFromUrlQuery(queryParameter: string): string {
const params = new URLSearchParams(window.location.search);
return params.get(queryParameter) || null;
return params.get(queryParameter) || "";
}
export function setUrlQueryParameter(parameter: string, value: string): void {