mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-05 18:09:04 +00:00
docs: update documentation for custom data-fetching hooks
This commit is contained in:
@@ -8,6 +8,23 @@ interface UseBreweryPostsByUserParams {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom hook to fetch brewery posts by a specific user.
|
||||
*
|
||||
* @param options The options to use when fetching brewery posts.
|
||||
* @param options.pageSize The number of brewery posts to fetch per page.
|
||||
* @param options.userId The ID of the user to fetch brewery posts for.
|
||||
* @returns An object with the following properties:
|
||||
*
|
||||
* - `breweryPosts`: The brewery posts fetched from the API.
|
||||
* - `error`: The error that occurred while fetching the data.
|
||||
* - `isAtEnd`: A boolean indicating whether all data has been fetched.
|
||||
* - `isLoading`: A boolean indicating whether the data is being fetched.
|
||||
* - `isLoadingMore`: A boolean indicating whether more data is being fetched.
|
||||
* - `pageCount`: The total number of pages of data.
|
||||
* - `setSize`: A function to set the size of the data.
|
||||
* - `size`: The size of the data.
|
||||
*/
|
||||
const useBreweryPostsByUser = ({ pageSize, userId }: UseBreweryPostsByUserParams) => {
|
||||
const fetcher = async (url: string) => {
|
||||
const response = await fetch(url);
|
||||
|
||||
Reference in New Issue
Block a user