fix: 修复前端类型标注与GraphQL访问数据不同的问题
- 将类型标注中的id字段改为string
This commit is contained in:
@ -15,7 +15,7 @@ export function toSolutionTypeView(raw: SolutionType): SolutionTypeView {
|
||||
const trans = raw?.translations?.[0];
|
||||
|
||||
return {
|
||||
id: raw.id,
|
||||
id: raw.id.toString(),
|
||||
name: trans?.name ?? '',
|
||||
sort: raw?.sort ?? 999,
|
||||
};
|
||||
@ -38,7 +38,7 @@ export function toSolutionListView(raw: Solution): SolutionListView {
|
||||
const type = isObject<SolutionType>(raw.type)
|
||||
? toSolutionTypeView(raw.type)
|
||||
: ({
|
||||
id: -1,
|
||||
id: '',
|
||||
name: 'uncategory',
|
||||
sort: 999,
|
||||
} satisfies SolutionTypeView);
|
||||
@ -46,7 +46,7 @@ export function toSolutionListView(raw: Solution): SolutionListView {
|
||||
const cover = isObject<DirectusFile>(raw.cover) ? (raw?.cover.id ?? '') : '';
|
||||
|
||||
return {
|
||||
id: raw.id,
|
||||
id: raw.id.toString(),
|
||||
title: trans?.title ?? '',
|
||||
summary: trans?.summary ?? '',
|
||||
solution_type: type,
|
||||
@ -69,7 +69,7 @@ export function toSolutionView(raw: Solution): SolutionView {
|
||||
const trans = raw.translations?.[0];
|
||||
|
||||
return {
|
||||
id: raw.id,
|
||||
id: raw.id.toString(),
|
||||
title: trans?.title ?? '',
|
||||
summary: trans?.summary ?? '',
|
||||
content: trans?.content ?? '',
|
||||
|
||||
Reference in New Issue
Block a user