-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Summary Fixes #1477 ## Changes proposed - Query params stay in sync with input - Pagination hooked up to query param and search
- Loading branch information
Showing
25 changed files
with
613 additions
and
139 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
// All exports in this file are server actions | ||
"use server"; | ||
|
||
import { SearchAPIResponse } from "../../types/searchTypes"; | ||
import { SearchFetcherProps } from "../../services/searchfetcher/SearchFetcher"; | ||
import { getSearchFetcher } from "../../services/searchfetcher/SearchFetcherUtil"; | ||
|
||
// Gets MockSearchFetcher or APISearchFetcher based on environment variable | ||
const searchFetcher = getSearchFetcher(); | ||
|
||
export async function updateResults() { | ||
return await searchFetcher.fetchOpportunities(); | ||
// Server action called when SearchForm is submitted | ||
export async function updateResults( | ||
prevState: SearchAPIResponse, | ||
formData: FormData, | ||
) { | ||
const pageValue = formData.get("currentPage"); | ||
const page = pageValue ? parseInt(pageValue as string, 10) : 1; | ||
const safePage = !isNaN(page) && page > 0 ? page : 1; | ||
|
||
const searchProps: SearchFetcherProps = { | ||
page: safePage, | ||
}; | ||
|
||
return await searchFetcher.fetchOpportunities(searchProps); | ||
} |
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
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
Oops, something went wrong.