store/cockpitApi: correct getBlueprint's cache tags

After editing a blueprint, the blueprint needs to be invalidated.
This commit is contained in:
Sanne Raymaekers 2025-03-03 18:22:47 +01:00 committed by Klara Simickova
parent c0187f7b76
commit b91981c17c

View file

@ -3,8 +3,13 @@ import { addNotification } from '@redhat-cloud-services/frontend-components-noti
import { cockpitApi } from './cockpitApi';
const enhancedApi = cockpitApi.enhanceEndpoints({
addTagTypes: ['Blueprints', 'Composes'],
addTagTypes: ['Blueprint', 'Blueprints', 'Composes'],
endpoints: {
getBlueprint: {
providesTags: () => {
return [{ type: 'Blueprint' }];
},
},
getBlueprints: {
providesTags: () => {
return [{ type: 'Blueprints' }];
@ -34,7 +39,7 @@ const enhancedApi = cockpitApi.enhanceEndpoints({
},
},
updateBlueprint: {
invalidatesTags: [{ type: 'Blueprints' }],
invalidatesTags: [{ type: 'Blueprint' }, { type: 'Blueprints' }],
onQueryStarted: async (_, { dispatch, queryFulfilled }) => {
queryFulfilled
.then(() => {