diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index 44cf56057..77b8e4eed 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -159,7 +159,7 @@ const ContentMapper = () => { newMigrationData?.destination_stack?.selectedStack?.value ); - if (contentTypeCount > 0) { + if (contentTypeCount?.data?.contenttype_count > 0) { setIsEmptyStack(false); } else { setIsEmptyStack(true); diff --git a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx index 32cd17a62..b22dcefea 100644 --- a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx +++ b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx @@ -116,13 +116,6 @@ const LoadStacks = (props: LoadFileFormatProps) => { }; updateNewMigrationData(newMigrationDataObj); - - //API call for saving selected CMS - if (data?.value) { - updateDestinationStack(selectedOrganisation?.value, projectId, { - stack_api_key: data?.value - }); - } } //call for Step Change diff --git a/ui/src/components/DestinationStack/index.tsx b/ui/src/components/DestinationStack/index.tsx index 35136b567..344722e9b 100644 --- a/ui/src/components/DestinationStack/index.tsx +++ b/ui/src/components/DestinationStack/index.tsx @@ -16,7 +16,10 @@ import './DestinationStack.scss'; import { isEmptyString, validateArray } from '../../utilities/functions'; import { getAllStacksInOrg } from '../../services/api/stacks.service'; import { MigrationResponse, StackResponse } from '../../services/api/service.interface'; -import { updateCurrentStepData } from '../../services/api/migration.service'; +import { + updateCurrentStepData, + updateDestinationStack +} from '../../services/api/migration.service'; import { getCMSDataFromFile } from '../../cmsData/cmsSelector'; type DestinationStackComponentProps = { @@ -59,6 +62,10 @@ const DestinationStackComponent = ({ const handleOnClick = async (event: MouseEvent) => { event.preventDefault(); //Update Data in backend + await updateDestinationStack(selectedOrganisation?.value, projectId, { + stack_api_key: newMigrationData?.destination_stack?.selectedStack?.value + }); + const res = await updateCurrentStepData(selectedOrganisation.value, projectId); if (res) { const url = `/projects/${projectId}/migration/steps/3`; diff --git a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx index 61ea98a2a..e48f42cdf 100644 --- a/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadFileFormat.tsx @@ -125,7 +125,7 @@ const LoadFileFormat = (props: LoadFileFormatProps) => {
-
diff --git a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx index 48161609a..07af04d12 100644 --- a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx @@ -117,7 +117,7 @@ const LoadPreFix = (props: LoadSelectCmsProps) => { />
-
diff --git a/ui/src/services/api/project.service.ts b/ui/src/services/api/project.service.ts index 57c7f721f..ed80c5da0 100644 --- a/ui/src/services/api/project.service.ts +++ b/ui/src/services/api/project.service.ts @@ -2,15 +2,15 @@ import { API_VERSION } from '../../utilities/constants'; import { getDataFromLocalStorage } from '../../utilities/functions'; import { getCall, postCall, putCall } from './service'; -const options = { +const options = () => ({ headers: { app_token: getDataFromLocalStorage('app_token') } -}; +}); export const getAllProjects = async (orgId: string) => { try { - return await getCall(`${API_VERSION}/org/${orgId}/project`, options); + return await getCall(`${API_VERSION}/org/${orgId}/project`, options()); } catch (error: any) { return error; } @@ -18,7 +18,7 @@ export const getAllProjects = async (orgId: string) => { export const getProject = async (orgId: string, projectId: string) => { try { - return await getCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, options); + return await getCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, options()); } catch (error: any) { return error; } @@ -26,7 +26,7 @@ export const getProject = async (orgId: string, projectId: string) => { export const createProject = async (orgId: string, data: any) => { try { - return await postCall(`${API_VERSION}/org/${orgId}/project/`, data, options); + return await postCall(`${API_VERSION}/org/${orgId}/project/`, data, options()); } catch (error: any) { return error; } @@ -34,7 +34,7 @@ export const createProject = async (orgId: string, data: any) => { export const updateProject = async (orgId: string, projectId: string, data: any) => { try { - return await putCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, data, options); + return await putCall(`${API_VERSION}/org/${orgId}/project/${projectId}`, data, options()); } catch (error: any) { return error; } diff --git a/ui/src/services/api/stacks.service.ts b/ui/src/services/api/stacks.service.ts index 3f704e0d1..abb79029e 100644 --- a/ui/src/services/api/stacks.service.ts +++ b/ui/src/services/api/stacks.service.ts @@ -25,10 +25,11 @@ export const createStacksInOrg = async (orgId: string, data: any) => { }; export const getStackStatus = async (orgId: string, data: string) => { - console.log('.................', orgId, data); - try { - return await postCall(`${API_VERSION}/org/${orgId}/stack_status`, data, options); + const stack_api = { + stack_api_key: data + }; + return await postCall(`${API_VERSION}/org/${orgId}/stack_status`, stack_api, options); } catch (error: any) { return error; }