File tree Expand file tree Collapse file tree 4 files changed +56
-36
lines changed Expand file tree Collapse file tree 4 files changed +56
-36
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import { ReactComponent as CheckIcon } from 'src/assets/icons/check-icon.svg';
1717import { ServiceResponse } from 'src/features/backoffice' ;
1818import { Link } from 'react-scroll' ;
1919import { extractStrapiData } from 'src/common/getStrapiData' ;
20+ import { getLocalizedStrapiData } from 'src/common/utils' ;
21+ import i18n from 'src/i18n' ;
2022import { ServiceExpressCta } from './ServiceExpressCta' ;
2123import { ServiceContactUsCta } from './ServiceContactUsCta' ;
2224
@@ -112,9 +114,11 @@ const ServiceTimeline = ({
112114 onContactClick : ( ) => void ;
113115} ) => {
114116 const { t } = useTranslation ( ) ;
115- const { data : serviceData } = response ;
116117 const STRAPI_URL = process . env . REACT_APP_STRAPI_URL || '' ;
117- const service = extractStrapiData ( { data : serviceData } ) ;
118+ const service = getLocalizedStrapiData ( {
119+ item : response ,
120+ language : i18n . language ,
121+ } ) ;
118122 const express = extractStrapiData ( service . express ) ;
119123 const expressType = extractStrapiData ( express . express_type ) ;
120124
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import { ReactComponent as FunctionalIcon } from 'src/assets/icons/functional-ic
1919import { ReactComponent as EnvironmentIcon } from 'src/assets/icons/environment-icon.svg' ;
2020import { ReactComponent as TimeIcon } from 'src/assets/icons/time-icon.svg' ;
2121import { extractStrapiData } from 'src/common/getStrapiData' ;
22+ import { getLocalizedStrapiData } from 'src/common/utils' ;
23+ import i18n from 'src/i18n' ;
2224import { ServiceExpressCta } from './ServiceExpressCta' ;
2325import { ServiceContactUsCta } from './ServiceContactUsCta' ;
2426
@@ -42,12 +44,14 @@ export const SingleServicePageHeader = ({
4244} ) => {
4345 const navigate = useNavigate ( ) ;
4446 const { t } = useTranslation ( ) ;
45- const { data : serviceData } = response ;
4647 const { activeWorkspace } = useAppSelector ( ( state ) => state . navigation ) ;
4748 const servicesRoute = useLocalizeRoute ( 'services' ) ;
4849 const homeRoute = useLocalizeRoute ( '' ) ;
4950 const STRAPI_URL = process . env . REACT_APP_STRAPI_URL || '' ;
50- const service = extractStrapiData ( { data : serviceData } ) ;
51+ const service = getLocalizedStrapiData ( {
52+ item : response ,
53+ language : i18n . language ,
54+ } ) ;
5155
5256 // Strapi response
5357 const days = service . duration_in_days ?? 3 ;
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ import { useAppDispatch, useAppSelector } from 'src/app/hooks';
88import { openWizard } from 'src/features/express/expressSlice' ;
99import { useGetFullServicesByIdQuery } from 'src/features/backoffice/strapi' ;
1010import PageLoader from 'src/features/templates/PageLoader' ;
11- import { extractStrapiData } from 'src/common/getStrapiData' ;
1211import { HubspotModal } from 'src/common/components/HubspotModal' ;
13- import { checkHubspotURL } from 'src/common/utils' ;
12+ import { checkHubspotURL , getLocalizedStrapiData } from 'src/common/utils' ;
13+ import i18n from 'src/i18n' ;
1414import { ServiceTimeline } from './ServiceTimeline' ;
1515import { SingleServicePageHeader } from './SingleServicePageHeader' ;
16+ import { strapiParams } from './strapi' ;
1617
1718const Service = ( ) => {
1819 const { templateId } = useParams ( ) ;
@@ -33,45 +34,22 @@ const Service = () => {
3334 const { data, isLoading, isError } = useGetFullServicesByIdQuery ( {
3435 id : templateId || '' ,
3536 populate : {
36- output_image : '*' ,
37- requirements : {
37+ ... strapiParams ,
38+ localizations : {
3839 populate : {
39- description : {
40- populate : '*' ,
41- } ,
42- list : {
43- populate : '*' ,
44- } ,
40+ ...strapiParams ,
4541 } ,
4642 } ,
47- why : {
48- populate : {
49- reasons : {
50- populate : '*' ,
51- } ,
52- advantages : {
53- populate : '*' ,
54- } ,
55- } ,
56- } ,
57- what : { populate : '*' } ,
58- how : {
59- populate : {
60- timeline : {
61- populate : '*' ,
62- } ,
63- } ,
64- } ,
65- express : {
66- populate : { express_type : '*' } ,
67- } ,
6843 } ,
6944 } ) ;
7045
7146 let service ;
7247
7348 if ( data ) {
74- service = extractStrapiData ( data ) ;
49+ service = getLocalizedStrapiData ( {
50+ item : data ,
51+ language : i18n . language ,
52+ } ) ;
7553 }
7654
7755 if ( isError ) {
Original file line number Diff line number Diff line change 1+ export const strapiParams = {
2+ output_image : '*' ,
3+ requirements : {
4+ populate : {
5+ description : {
6+ populate : '*' ,
7+ } ,
8+ list : {
9+ populate : '*' ,
10+ } ,
11+ } ,
12+ } ,
13+ why : {
14+ populate : {
15+ reasons : {
16+ populate : '*' ,
17+ } ,
18+ advantages : {
19+ populate : '*' ,
20+ } ,
21+ } ,
22+ } ,
23+ what : { populate : '*' } ,
24+ how : {
25+ populate : {
26+ timeline : {
27+ populate : '*' ,
28+ } ,
29+ } ,
30+ } ,
31+ express : {
32+ populate : { express_type : '*' } ,
33+ } ,
34+ } ;
You can’t perform that action at this time.
0 commit comments