From 3a6e3b9f37c1af1ff41bbfe038dcb8425dcc651a Mon Sep 17 00:00:00 2001 From: SKairinos Date: Thu, 15 Aug 2024 15:23:51 +0000 Subject: [PATCH] fix api --- src/api/fruit.ts | 5 +++-- src/pages/fruitList/FruitList.tsx | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/fruit.ts b/src/api/fruit.ts index 1dd8c28..5940f92 100644 --- a/src/api/fruit.ts +++ b/src/api/fruit.ts @@ -69,7 +69,7 @@ const fruitApi = api.injectEndpoints({ url: buildUrl(fruitUrls.list, { search }), method: "GET", }), - providesTags: tagData("Fruit"), + providesTags: tagData("Fruit", { includeListTag: true }), }), createFruit: build.mutation({ query: body => ({ @@ -77,6 +77,7 @@ const fruitApi = api.injectEndpoints({ method: "POST", body, }), + invalidatesTags: tagData("Fruit", { includeListTag: true }), }), updateFruit: build.mutation({ query: ({ id, ...body }) => ({ @@ -91,7 +92,7 @@ const fruitApi = api.injectEndpoints({ url: buildUrl(fruitUrls.detail, { url: { id } }), method: "DELETE", }), - invalidatesTags: tagData("Fruit"), + invalidatesTags: tagData("Fruit", { includeListTag: true }), }), }), }) diff --git a/src/pages/fruitList/FruitList.tsx b/src/pages/fruitList/FruitList.tsx index e7b0765..d3b2b3d 100644 --- a/src/pages/fruitList/FruitList.tsx +++ b/src/pages/fruitList/FruitList.tsx @@ -27,7 +27,10 @@ const FruitList: FC = () => { return ( - + {fruits => fruits.map(fruit => (