|
|
|
@ -9,7 +9,7 @@ import dayjs from 'dayjs';
|
|
|
|
|
export const fetchTemplates = async () => {
|
|
|
|
|
const data = await fetchJSON(`${API_HOST}/listtemplates`);
|
|
|
|
|
const canUseTemplates = (data?.result?.items || [])
|
|
|
|
|
.filter((_t) => _t.status !== 'REJECTED')
|
|
|
|
|
.filter((_t) => _t.status === 'APPROVED')
|
|
|
|
|
.map((ele) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()) }));
|
|
|
|
|
const topName = ['say_hello_from_trip_advisor', 'free_style_7', 'free_style_2', 'free_style_1', 'free_style_3', 'free_style_4'];
|
|
|
|
|
const top = sortArrayByOrder( canUseTemplates.filter((_t) => topName.includes(_t.name)), 'name', topName);
|
|
|
|
|