Skip to content

Commit

Permalink
Merge pull request #25 from Lemonnnnnnnnnnn/master
Browse files Browse the repository at this point in the history
fix: 修复新增分类/接口报错的问题
  • Loading branch information
Lemonnnnnnnnnnn authored Mar 14, 2024
2 parents 80c7de4 + e06a0da commit acdff1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
17 changes: 8 additions & 9 deletions src/routes/type/components/ProjectTab/AddInterfaceModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@

try {
toast.push('正在获取接口信息...', toastTheme.success);
const interfaceDataItem = await invoke<SuccessResponse<InterfaceDataItem & { ts: string }>>(
'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);
Expand Down
15 changes: 9 additions & 6 deletions src/routes/type/components/ProjectTab/Interface.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@

async function preview(interface_id: number) {
toast.push('正在获取接口信息...', toastTheme.success);
await invoke<SuccessResponse<InterfaceDataItem & { ts: string }>>('get_interface_detail', {
data: {
token,
source_path: $sourcePath,
interface_id
await invoke<SuccessResponse<{ interface_data: InterfaceDataItem; ts: string }>>(
'get_interface_detail',
{
data: {
token,
source_path: $sourcePath,
interface_id
}
}
})
)
.then((res) => {
$PreviewModalOpen = true;
$PreviewModalContent = res.data.ts;
Expand Down

0 comments on commit acdff1e

Please sign in to comment.