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 => (