Skip to content

Commit

Permalink
feat: update cms usage to cockpit hq
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvanr committed Dec 7, 2023
1 parent c81b61b commit c52452e
Show file tree
Hide file tree
Showing 34 changed files with 47 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/app/modules/country-detail-module/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ export default function CountryDetail() {
(store) => store.EligibilityCountry.clear
);
const countrySummaryCMSAction = useStoreActions(
(actions) => actions.cms.countrySummary.post
(actions) => actions.cms.countrySummary.fetch
);
const clearCountrySummaryCMS = useStoreActions(
(store) => store.cms.countrySummary.clear
);
const notesDisclaimersCMSAction = useStoreActions(
(actions) => actions.cms.notesAndDisclaimers.post
(actions) => actions.cms.notesAndDisclaimers.fetch
);
const appliedFilters = useStoreState((state) => state.AppliedFiltersState);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export function LocationDetailOverviewModule(props: Props) {
})
);
const countrySummaryCMSData = useStoreState((state) =>
get(state.cms.countrySummary, "data.entries[0].summary", null)
get(state.cms.countrySummary, "data.summary", null)
);
const notesDisclaimersCMSData = useStoreState((state) =>
get(state.cms.notesAndDisclaimers, "data.entries[0].content", null)
const notesDisclaimersCMSData = useStoreState((state) =>
get(state.cms.notesAndDisclaimers, "data.content", null)
);

let investmentLgValue: GridSize = 12;
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/componentsAppBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsAppBar: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsAppBar?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsAppBar`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsBudgets: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsBudgets?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsBudgets`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsCommon: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsCommon?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsCommon`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsEligibility: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsEligibility?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsEligibility`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsGeomap: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsGeomap?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsGeomap`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsGrants: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsGrants?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsGrants`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsInvestments: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsInvestments?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsInvestments`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsNetwork: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsNetwork?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsNetwork`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsPerformanceRating: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsPerformanceRating?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsPerformanceRating`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsChartsPledges: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsChartsPledges?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsChartsPledges`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsCookieDialog: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsCookieDialog?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsCookieDialog`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsDatasetCarousel: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsDatasetCarousel?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsDatasetCarousel`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsDialogBox: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsDialogBox?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsDialogBox`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsInformationPanel: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsInformationPanel?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsInformationPanel`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/componentsMobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsMobile: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsMobile?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsMobile`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsPageHeader: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsPageHeader?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsPageHeader`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsPerformanceFrameworkComponents: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsPerformanceFrameworkComponents?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsPerformanceFrameworkComponents`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/componentsSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsSearch: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsSearch?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsSearch`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/componentsSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsSidebar: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsSidebar?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsSidebar`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsSlideInPanel: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsSlideInPanel?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsSlideInPanel`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/componentsTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const componentsTable: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/componentsTable?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/componentsTable`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/countrySummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const countrySummary: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/collections/get/countrySummary?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/countrySummary`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/modulesAbout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesAbout: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesAbout?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesAbout`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/modulesCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesCommon: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesCommon?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesCommon`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesCountryDetail: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesCountryDetail?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesCountryDetail`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/modulesDatasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesDatasets: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesDatasets?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesDatasets`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesFundingRequests: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesFundingRequests?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesFundingRequests`
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesGrantDetail: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesGrantDetail?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesGrantDetail`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/modulesGrants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesGrants: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesGrants?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesGrants`
),
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/state/api/action-reducers/cms/modulesLanding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const modulesLanding: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/singletons/get/modulesLanding?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/modulesLanding`
),
};

Expand Down
7 changes: 6 additions & 1 deletion src/app/state/api/action-reducers/cms/notesAndDisclaimers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import { CMSApiCallModel } from "app/state/api/interfaces";

const notesAndDisclaimers: CMSApiCallModel = {
...APIModel(
`${process.env.REACT_APP_CMS_API}/collections/get/notesAndDisclaimers?token=${process.env.REACT_APP_CMS_TOKEN}`
`${process.env.REACT_APP_CMS_API}/content/item/notesAndDisclaimers`
),
};

export default notesAndDisclaimers;

/**
https://cms-prod.tgf.nyuki.io/api/singletons/get/componentsAppBar?token=account-fafa59d165d28d24a5de7214435942
https://cms-prod.tgf.nyuki.io/api/collections/get/notesAndDisclaimers?token=account-fafa59d165d28d24a5de7214435942
*/
11 changes: 6 additions & 5 deletions src/app/state/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ export const APIModel = <QueryModel, ResponseModel>(
}),
fetch: thunk(async (actions, query: RequestValues<QueryModel>) => {
actions.onRequest();
const headers: any = {
"Content-Type": "application/json",
...(process.env.REACT_APP_CMS_API && url.includes(process.env.REACT_APP_CMS_API) ? {"api-key": process.env.REACT_APP_CMS_TOKEN} : {}),
};
if (url.includes('content/items')) console.log('debuggy - querying url', url)
axios
.get(
`${url}${query.filterString ? "?" : ""}${query.filterString ?? ""}`,
{
headers: {
"Content-Type": "application/json",
},
}
{ headers }
)
.then(
(resp: AxiosResponse) =>
Expand Down

0 comments on commit c52452e

Please sign in to comment.