Skip to content

Commit

Permalink
Skip backend request for empty search
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Pesce committed Jun 28, 2023
1 parent 44edba2 commit 14133d2
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions frontend/src/ResourceSearchBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,24 @@
on:submit|preventDefault="{async (e) => {
try {
if (searchType == 'String') {
searchFilter = await rootResource.search_for_string(
searchQuery,
regex,
caseIgnore
);
if (searchQuery === '') {
searchFilter = null;
} else {
searchFilter = await rootResource.search_for_string(
searchQuery,
regex,
caseIgnore
);
}
} else if (searchType == 'Bytes') {
searchFilter = await rootResource.search_for_bytes(
searchQuery,
false
);
if (searchQuery === '') {
searchFilter = null;
} else {
searchFilter = await rootResource.search_for_bytes(
searchQuery,
false
);
}
}
} catch (err) {
try {
Expand Down

0 comments on commit 14133d2

Please sign in to comment.