refactor: 调整首页数据获取API
- 将首页的数据获取由REST重构为GraphQL
This commit is contained in:
@ -11,7 +11,8 @@ export function toHomepageView(raw: Homepage): HomepageView {
|
||||
const carousel = (raw.carousel ?? [])
|
||||
.filter(isObject<HomepageFile>)
|
||||
.map((item) => item.directus_files_id)
|
||||
.filter((item) => typeof item === 'string');
|
||||
.filter(isObject<DirectusFile>)
|
||||
.map((file) => file.id);
|
||||
|
||||
const products = (raw.recommend_products ?? [])
|
||||
.filter(isObject<Product>)
|
||||
|
||||
Reference in New Issue
Block a user