src/store: Remove server store hooks

Removing the server store makes the way we handle data going in and out
of the wizard state more consistent. Each customisation is mapped into
the wizard state and pulled out when generating the blueprint
payload.

When the services and kernel customisations are implemented, this
information will need to be stored inside of the wizard state anyway.

Lastly this will make implementing a compliance step easier for edit
mode, removing the need to write to the wizard state from within the
server store when only a compliance policy id is available (on the
review page), which would be used to fetch the profile ref id, which
would in turn be used to fetch the customisations not stored in the
wizard state.
This commit is contained in:
Sanne Raymaekers 2024-09-13 12:18:54 +02:00 committed by Klara Simickova
parent 3038c0783b
commit 0897257125
5 changed files with 104 additions and 90 deletions

View file

@ -15,7 +15,6 @@ import { useNavigate, useParams } from 'react-router-dom';
import { CreateSaveAndBuildBtn, CreateSaveButton } from './CreateDropdown';
import { EditSaveAndBuildBtn, EditSaveButton } from './EditDropdown';
import { useServerStore } from '../../../../../store/hooks';
import {
useCreateBlueprintMutation,
useUpdateBlueprintMutation,
@ -30,7 +29,6 @@ const ReviewWizardFooter = () => {
useCreateBlueprintMutation({ fixedCacheKey: 'createBlueprintKey' });
// initialize the server store with the data from RTK query
const serverStore = useServerStore();
const [, { isSuccess: isUpdateSuccess, reset: resetUpdate }] =
useUpdateBlueprintMutation({ fixedCacheKey: 'updateBlueprintKey' });
const { auth } = useChrome();
@ -54,7 +52,7 @@ const ReviewWizardFooter = () => {
const getBlueprintPayload = async () => {
const userData = await auth?.getUser();
const orgId = userData?.identity?.internal?.org_id;
const requestBody = orgId && mapRequestFromState(store, orgId, serverStore);
const requestBody = orgId && mapRequestFromState(store, orgId);
return requestBody;
};