mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
fix update error
This commit is contained in:
parent
71bb2c5f05
commit
bedf3f8173
|
@ -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)
|
||||
|
|
|
@ -35,6 +35,8 @@ const Profiles: React.FC = () => {
|
|||
setImporting(true)
|
||||
try {
|
||||
await addProfileItem({ name: '', type: 'remote', url })
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
} finally {
|
||||
setImporting(false)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user