fix override update logic

This commit is contained in:
pompurin404 2024-09-12 18:57:24 +08:00
parent 97e84f9447
commit f1ca8a5b7a
No known key found for this signature in database
2 changed files with 11 additions and 4 deletions

View File

@ -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()
}

View File

@ -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