mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-07 06:24:14 +08:00
@@ -218,4 +218,10 @@ export const resetUploaderConfig = (type: string, id: string) => {
|
|||||||
picgo.saveConfig({
|
picgo.saveConfig({
|
||||||
[`uploader.${type}.configList`]: configList
|
[`uploader.${type}.configList`]: configList
|
||||||
})
|
})
|
||||||
|
const currentDefault = picgo.getConfig<IStringKeyMap>(`picBed.${type}`) ?? {}
|
||||||
|
if (currentDefault._id === id) {
|
||||||
|
picgo.saveConfig({
|
||||||
|
[`picBed.${type}`]: configList
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ function handleDropdownBlur() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
loading.value = true
|
|
||||||
try {
|
try {
|
||||||
const result = (await $configForm.value?.validate()) || false
|
const result = (await $configForm.value?.validate()) || false
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
@@ -164,8 +163,6 @@ const handleConfirm = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to save configuration:', error)
|
console.error('Failed to save configuration:', error)
|
||||||
message.error(t('pages.picBedConfigs.setFailedInfo'))
|
message.error(t('pages.picBedConfigs.setFailedInfo'))
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,18 +209,13 @@ async function handleConfigImport(configItem: IUploaderConfigListItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleReset = async () => {
|
const handleReset = async () => {
|
||||||
loading.value = true
|
|
||||||
try {
|
try {
|
||||||
await window.electron.triggerRPC<void>(IRPCActionType.UPLOADER_RESET_CONFIG, type.value, $route.params.configId)
|
await window.electron.triggerRPC<void>(IRPCActionType.UPLOADER_RESET_CONFIG, type.value, $route.params.configId)
|
||||||
message.success(t('pages.picBedConfigs.resetSuccess'))
|
message.success(t('pages.picBedConfigs.resetSuccess'))
|
||||||
setTimeout(() => {
|
$router.back()
|
||||||
$router.back()
|
|
||||||
}, 1000)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to reset configuration:', error)
|
console.error('Failed to reset configuration:', error)
|
||||||
message.error(t('pages.picBedConfigs.resetFailed'))
|
message.error(t('pages.picBedConfigs.resetFailed'))
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user