🐛 Fix(custom): fix picbed config reset issue

ISSUES CLOSED: #375
This commit is contained in:
Kuingsmile
2025-08-21 09:36:04 +08:00
parent dbade21289
commit 934a716106
2 changed files with 7 additions and 9 deletions

View File

@@ -218,4 +218,10 @@ export const resetUploaderConfig = (type: string, id: string) => {
picgo.saveConfig({
[`uploader.${type}.configList`]: configList
})
const currentDefault = picgo.getConfig<IStringKeyMap>(`picBed.${type}`) ?? {}
if (currentDefault._id === id) {
picgo.saveConfig({
[`picBed.${type}`]: configList
})
}
}

View File

@@ -145,7 +145,6 @@ function handleDropdownBlur() {
}
const handleConfirm = async () => {
loading.value = true
try {
const result = (await $configForm.value?.validate()) || false
if (result !== false) {
@@ -164,8 +163,6 @@ const handleConfirm = async () => {
} catch (error) {
console.error('Failed to save configuration:', error)
message.error(t('pages.picBedConfigs.setFailedInfo'))
} finally {
loading.value = false
}
}
@@ -212,18 +209,13 @@ async function handleConfigImport(configItem: IUploaderConfigListItem) {
}
const handleReset = async () => {
loading.value = true
try {
await window.electron.triggerRPC<void>(IRPCActionType.UPLOADER_RESET_CONFIG, type.value, $route.params.configId)
message.success(t('pages.picBedConfigs.resetSuccess'))
setTimeout(() => {
$router.back()
}, 1000)
$router.back()
} catch (error) {
console.error('Failed to reset configuration:', error)
message.error(t('pages.picBedConfigs.resetFailed'))
} finally {
loading.value = false
}
}