Skip to content

Commit

Permalink
fix update error
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Aug 13, 2024
1 parent 71bb2c5 commit bedf3f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/config/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ export async function updateProfileItem(item: IProfileItem): Promise<void> {
}
config.items[index] = item
await setProfileConfig(config)
await addProfileUpdater(item)
}

export async function addProfileItem(item: Partial<IProfileItem>): Promise<void> {
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)
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/pages/profiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const Profiles: React.FC = () => {
setImporting(true)
try {
await addProfileItem({ name: '', type: 'remote', url })
} catch (e) {
alert(e)
} finally {
setImporting(false)
}
Expand Down

0 comments on commit bedf3f8

Please sign in to comment.