For example I try to get both language in my endpoin “GET” or I need another function and change my locale, because I want both language in one petition. What I need to do. This is my code:
async getHome(){
try{
const config = {
method: ‘GET’, // Método GET
params: {
‘populate[0]’: ‘header.logo’,
‘populate[1]’: ‘header.menuLinks.headerLinks’,
‘populate[2]’: ‘header.icons’,
‘populate[3]’: ‘banner.button’,
‘populate[4]’: ‘grid.button’,
‘populate[5]’: ‘testimonials’,
‘populate[6]’: ‘footer.footerLinks’,
‘locale’: ‘es’,
‘locale’: ‘en’,
},
headers: {
‘Content-Type’: ‘application/json’
/* ‘Authorization’: Bearer ${process.env.ACCESS_TOKEN}
*/
}
};
const response = await api(‘/api/home’, config);
const homeData = response.data
this.headerIcons = homeData.data.header.icons;
this.headerLogo = homeData.data.header.logo;
this.headerMenu = homeData.data.header.menuLinks;
/* console.log('ICONS:',this.headerIcons)
console.log('LOGO:',this.headerLogo)
console.log('MENU:',this.headerMenu) */
console.log('home data:', homeData);
return homeData
} catch(error){
console.log('Error al obtener datos de home:', error)
throw error
}
}
This topic has been created from a Discord post (1295333944627302521) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord