- 将文件ID从字符串转换为数字类型,解决后端接口参数类型不匹配问题
@@ -57,7 +57,7 @@ export const ImageSelector: React.FC<ImageSelectorProps> = ({
queryKey: ['file-detail', value],
queryFn: async () => {
if (!value) return null;
- const response = await fileClient[':id']['$get']({ param: { id: value.toString() } });
+ const response = await fileClient[':id']['$get']({ param: { id: Number(value) } });
if (response.status !== 200) throw new Error('获取文件详情失败');
return response.json();
},