mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-15 19:22:31 +08:00
fix override update logic
This commit is contained in:
parent
97e84f9447
commit
f1ca8a5b7a
|
@ -10,6 +10,7 @@ import {
|
|||
} from '@nextui-org/react'
|
||||
import React, { useState } from 'react'
|
||||
import SettingItem from '../base/base-setting-item'
|
||||
import { restartCore } from '@renderer/utils/ipc'
|
||||
interface Props {
|
||||
item: IOverrideItem
|
||||
updateOverrideItem: (item: IOverrideItem) => Promise<void>
|
||||
|
@ -21,6 +22,7 @@ const EditInfoModal: React.FC<Props> = (props) => {
|
|||
|
||||
const onSave = async (): Promise<void> => {
|
||||
await updateOverrideItem(values)
|
||||
await restartCore()
|
||||
onClose()
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import EditInfoModal from './edit-info-modal'
|
|||
import { useSortable } from '@dnd-kit/sortable'
|
||||
import { CSS } from '@dnd-kit/utilities'
|
||||
import ExecLogModal from './exec-log-modal'
|
||||
import { openFile } from '@renderer/utils/ipc'
|
||||
import { openFile, restartCore } from '@renderer/utils/ipc'
|
||||
|
||||
interface Props {
|
||||
info: IOverrideItem
|
||||
|
@ -186,11 +186,16 @@ const OverrideItem: React.FC<Props> = (props) => {
|
|||
variant="light"
|
||||
color="default"
|
||||
disabled={updating}
|
||||
onPress={() => {
|
||||
onPress={async () => {
|
||||
setUpdating(true)
|
||||
addOverrideItem(info).finally(() => {
|
||||
try {
|
||||
await addOverrideItem(info)
|
||||
await restartCore()
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
} finally {
|
||||
setUpdating(false)
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IoMdRefresh
|
||||
|
|
Loading…
Reference in New Issue
Block a user