List Data
Description
Provide your function that will return the data that the MRAD will use to display.
Create
Create your function that will return the data in the format specified in the example.
tip
There should also be data in your list for each language selection option. The MRAD will select the appropriate data based on the selected language and display it in a list.
Example:
src/admin/actions.ts
export async function heroListData(locale: string): Promise<Object[]> {
const data: any = {
en: [
{
id_hero: 1,
title: 'We create furniture',
description: 'We create and make furniture according to your wishes...',
image_alt: null,
button_text: 'Explore more...',
locale: 'en',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: '#1128da',
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
}
],
de: [
{
id_hero: 1,
title: 'Wir schaffen Möbel',
description: 'Wir entwerfen und fertigen Möbel nach Ihren Wünschen...',
image_alt: null,
button_text: 'Explore more...',
locale: 'de',
display: 1,
text_position: 0,
title_color: '#a7a77c',
description_color: 'rgba(0, 0, 0, 0.8)',
background_color: '#1128da',
background_image_path: '/assets/images/logo/logo.png',
background_height: 700,
image_path: null,
image_height: null,
button_link: '#',
date_add: '2024-10-27T12:18:40.000Z',
date_upd: '2024-10-27T12:18:40.000Z'
}
]
};
return data[locale];
}
Params:
- locale: A string that represents the selected language option based on which data will be returned from the database only for that language.