mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Work on brewery page, refactors
Refactor query types to explicitly use z.infer
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import useSWR from 'swr';
|
||||
import { beerPostQueryResultArraySchema } from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { z } from 'zod';
|
||||
|
||||
const useBeerPostSearch = (query: string | undefined) => {
|
||||
const { data, isLoading, error } = useSWR(
|
||||
@@ -13,7 +14,7 @@ const useBeerPostSearch = (query: string | undefined) => {
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
const result = beerPostQueryResultArraySchema.parse(json);
|
||||
const result = z.array(beerPostQueryResult).parse(json);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user