mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-18 16:27:38 +08:00
✨ Feature: picbeds config can be reseted to empty now
This commit is contained in:
@@ -167,3 +167,23 @@ export const updateUploaderConfig = (type: string, id: string, config: IStringKe
|
||||
[`picBed.${type}`]: updatedConfig
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset selected congfig id to default
|
||||
*/
|
||||
|
||||
export const resetUploaderConfig = (type: string, id: string) => {
|
||||
const { configList } = getUploaderConfigList(type)
|
||||
configList.forEach((item: IStringKeyMap) => {
|
||||
if (item._id === id) {
|
||||
Object.keys(item).forEach(key => {
|
||||
if (!['_configName', '_id', '_createdAt', '_updatedAt'].includes(key)) {
|
||||
delete item[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
picgo.saveConfig({
|
||||
[`uploader.${type}.configList`]: configList
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user