diff --git a/src/routes/type/components/ProjectTab/AddInterfaceModal.svelte b/src/routes/type/components/ProjectTab/AddInterfaceModal.svelte index 826dae0..4c06dc6 100644 --- a/src/routes/type/components/ProjectTab/AddInterfaceModal.svelte +++ b/src/routes/type/components/ProjectTab/AddInterfaceModal.svelte @@ -28,16 +28,15 @@ try { toast.push('正在获取接口信息...', toastTheme.success); - const interfaceDataItem = await invoke>( - 'get_interface_detail', - { - data: { - token, - source_path: $sourcePath, - interface_id: Number(form.interface_id) - } + const interfaceDataItem = await invoke< + SuccessResponse<{ interface_data: InterfaceDataItem; ts: string }> + >('get_interface_detail', { + data: { + token, + source_path: $sourcePath, + interface_id: Number(form.interface_id) } - ).then((res) => res.data); + }).then((res) => res.data.interface_data); if (isCategoryExist(interfaceDataItem.catid, categories)) { toast.push(`接口所在分类已存在`, toastTheme.success); diff --git a/src/routes/type/components/ProjectTab/Interface.svelte b/src/routes/type/components/ProjectTab/Interface.svelte index dbd691b..d605f7d 100644 --- a/src/routes/type/components/ProjectTab/Interface.svelte +++ b/src/routes/type/components/ProjectTab/Interface.svelte @@ -24,13 +24,16 @@ async function preview(interface_id: number) { toast.push('正在获取接口信息...', toastTheme.success); - await invoke>('get_interface_detail', { - data: { - token, - source_path: $sourcePath, - interface_id + await invoke>( + 'get_interface_detail', + { + data: { + token, + source_path: $sourcePath, + interface_id + } } - }) + ) .then((res) => { $PreviewModalOpen = true; $PreviewModalContent = res.data.ts;