Skip to content

Commit

Permalink
fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Aug 15, 2024
1 parent 4034e35 commit 3a6e3b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/api/fruit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ const fruitApi = api.injectEndpoints({
url: buildUrl(fruitUrls.list, { search }),
method: "GET",
}),
providesTags: tagData("Fruit"),
providesTags: tagData("Fruit", { includeListTag: true }),
}),
createFruit: build.mutation<CreateFruitResult, CreateFruitArg>({
query: body => ({
url: fruitUrls.list,
method: "POST",
body,
}),
invalidatesTags: tagData("Fruit", { includeListTag: true }),
}),
updateFruit: build.mutation<UpdateFruitResult, UpdateFruitArg>({
query: ({ id, ...body }) => ({
Expand All @@ -91,7 +92,7 @@ const fruitApi = api.injectEndpoints({
url: buildUrl(fruitUrls.detail, { url: { id } }),
method: "DELETE",
}),
invalidatesTags: tagData("Fruit"),
invalidatesTags: tagData("Fruit", { includeListTag: true }),
}),
}),
})
Expand Down
5 changes: 4 additions & 1 deletion src/pages/fruitList/FruitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const FruitList: FC<FruitListProps> = () => {
return (
<pages.Page>
<pages.Section>
<TablePagination useLazyListQuery={useLazyListFruitsQuery}>
<TablePagination
useLazyListQuery={useLazyListFruitsQuery}
preferCacheValue
>
{fruits =>
fruits.map(fruit => (
<Stack direction="row" key={fruit.id} gap={5}>
Expand Down

0 comments on commit 3a6e3b9

Please sign in to comment.