forked from face-hh/lyntr
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
4 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit 6c7d7e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alr, now my pr is fixed
so, i added the user search query but forgot to add the button
here are the changed parts of src/routes/Search.svelte:
1. Added user search query:
async function performSearch() {
if (!searchQuery.trim()) return;
isLoading = true;
hasSearched = true;
try {
const response = await fetch(`/api/search?q=${encodeURIComponent(searchQuery)}`, {
method: 'GET'
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
searchResults = await response.json();
if (searchQuery === "users") {
searchResults.type = "users";
} else {
searchResults.type = "lynts";
}
} catch (error) {
console.error('Search error:', error);
toast('Failed to perform search. Please try again.');
} finally {
isLoading = false;
}
}
2. Added the user search button
<Button on:click={performSearch}>Search</Button>
<Button on:click={() => {
searchQuery = "from:@" + myHandle;
performSearch();
}} class="ml-2">You</Button>
<Button on:click={() => {
searchQuery = "users";
performSearch();
}} class="ml-2">Users</Button>
forgot to change the button text to Users