mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10: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
|
config.items[index] = item
|
||||||
await setProfileConfig(config)
|
await setProfileConfig(config)
|
||||||
await addProfileUpdater(item)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addProfileItem(item: Partial<IProfileItem>): Promise<void> {
|
export async function addProfileItem(item: Partial<IProfileItem>): Promise<void> {
|
||||||
const newItem = await createProfile(item)
|
const newItem = await createProfile(item)
|
||||||
const config = await getProfileConfig()
|
const config = await getProfileConfig()
|
||||||
if (await getProfileItem(item.id)) {
|
if (await getProfileItem(newItem.id)) {
|
||||||
await updateProfileItem(newItem)
|
await updateProfileItem(newItem)
|
||||||
} else {
|
} else {
|
||||||
config.items.push(newItem)
|
config.items.push(newItem)
|
||||||
|
|||||||
@ -35,6 +35,8 @@ const Profiles: React.FC = () => {
|
|||||||
setImporting(true)
|
setImporting(true)
|
||||||
try {
|
try {
|
||||||
await addProfileItem({ name: '', type: 'remote', url })
|
await addProfileItem({ name: '', type: 'remote', url })
|
||||||
|
} catch (e) {
|
||||||
|
alert(e)
|
||||||
} finally {
|
} finally {
|
||||||
setImporting(false)
|
setImporting(false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user