Work on brewery page, refactors

Refactor query types to explicitly use z.infer
This commit is contained in:
Aaron William Po
2023-03-31 21:13:35 -04:00
parent d8a8dad37f
commit b69dbc95b4
33 changed files with 308 additions and 243 deletions

View File

@@ -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;
},