mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Add custom hooks for time distance and retrieving like count
Documentation added to all custom hooks
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import useSWR from 'swr';
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* A custom React hook that searches for beer posts that match a given query string.
|
||||
*
|
||||
* @param query The search query string to match beer posts against.
|
||||
* @returns An object containing an array of search results matching the query, an error
|
||||
* object if an error occurred during the search, and a boolean indicating if the
|
||||
* request is currently loading.
|
||||
*/
|
||||
const useBeerPostSearch = (query: string | undefined) => {
|
||||
const { data, isLoading, error } = useSWR(
|
||||
`/api/beers/search?search=${query}`,
|
||||
|
||||
Reference in New Issue
Block a user