fix: 修复前端类型标注与GraphQL访问数据不同的问题
- 将类型标注中的id字段改为string
This commit is contained in:
@ -19,7 +19,7 @@ export function toProductDocumentView(
|
||||
const url = `/api/assets/${fileId}`;
|
||||
|
||||
return {
|
||||
id: raw.id,
|
||||
id: raw.id.toString(),
|
||||
fileId: fileId,
|
||||
filename: file?.filename_download ?? '',
|
||||
title: trans?.title ?? '',
|
||||
@ -52,22 +52,22 @@ export function toDocumentListView(raw: ProductDocument): DocumentListView {
|
||||
.map((item) => {
|
||||
const productType = isObject<ProductType>(item.product_type)
|
||||
? ({
|
||||
id: item.product_type.id,
|
||||
id: item.product_type.id.toString(),
|
||||
name: item.product_type.translations?.[0]?.name ?? '',
|
||||
} satisfies DocumentListProductType)
|
||||
: ({
|
||||
id: -1,
|
||||
id: '',
|
||||
name: '',
|
||||
} satisfies DocumentListProductType);
|
||||
return {
|
||||
id: item.id,
|
||||
id: item.id.toString(),
|
||||
name: item.translations?.[0]?.name ?? '',
|
||||
type: productType,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
id: raw.id,
|
||||
id: raw.id.toString(),
|
||||
fileId: fileId,
|
||||
filename: file?.filename_download ?? '',
|
||||
title: trans?.title ?? '',
|
||||
|
||||
Reference in New Issue
Block a user