| }; | }; | ||||
| const api_url = process.env.REACT_APP_API_URL; | |||||
| const strapiPopulate = [ | |||||
| 'Heading', | |||||
| 'Heading.subtitle', | |||||
| 'Heading.title', | |||||
| 'WhyUsHeading', | |||||
| 'Cards', | |||||
| 'Cards.Card1', | |||||
| 'Cards.Card1.Icon', | |||||
| 'Cards.Card2', | |||||
| 'Cards.Card2.Icon', | |||||
| 'Cards.Card3', | |||||
| 'Cards.Card3.Icon', | |||||
| 'HeroNumbers', | |||||
| 'HeroNumbers.number', | |||||
| ]; | |||||
| const stringBuilder = () => { | |||||
| let stringQuery = ''; | |||||
| strapiPopulate.map((item, index) => { | |||||
| if (index !== 0) stringQuery += '&'; | |||||
| stringQuery += `populate=${item}`; | |||||
| }); | |||||
| return stringQuery; | |||||
| }; | |||||
| const [{ data, isLoading, isError }, doFetch] = useDataApi( | |||||
| `${api_url}/api/w-home-page?${stringBuilder()}`, | |||||
| ); | |||||
| const Segment = ({children}) => { | const Segment = ({children}) => { | ||||
| return ( | return ( | ||||
| <div className='py-[48px] mx-auto w-full text-center'> | <div className='py-[48px] mx-auto w-full text-center'> |