mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +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…
x
Reference in New Issue
Block a user