From bedf3f817394593855e98422810e59d2b602a37b Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Tue, 13 Aug 2024 16:12:56 +0800 Subject: [PATCH] fix update error --- src/main/config/profile.ts | 3 +-- src/renderer/src/pages/profiles.tsx | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/config/profile.ts b/src/main/config/profile.ts index e8425c2..2bc23ea 100644 --- a/src/main/config/profile.ts +++ b/src/main/config/profile.ts @@ -55,13 +55,12 @@ export async function updateProfileItem(item: IProfileItem): Promise { } config.items[index] = item await setProfileConfig(config) - await addProfileUpdater(item) } export async function addProfileItem(item: Partial): Promise { const newItem = await createProfile(item) const config = await getProfileConfig() - if (await getProfileItem(item.id)) { + if (await getProfileItem(newItem.id)) { await updateProfileItem(newItem) } else { config.items.push(newItem) diff --git a/src/renderer/src/pages/profiles.tsx b/src/renderer/src/pages/profiles.tsx index 1fc5a24..766dc2c 100644 --- a/src/renderer/src/pages/profiles.tsx +++ b/src/renderer/src/pages/profiles.tsx @@ -35,6 +35,8 @@ const Profiles: React.FC = () => { setImporting(true) try { await addProfileItem({ name: '', type: 'remote', url }) + } catch (e) { + alert(e) } finally { setImporting(false) }