🐛 Fix: fix batch delete bug of gallery page

ISSUES CLOSED: #54
This commit is contained in:
萌萌哒赫萝 2023-05-23 10:02:23 +08:00
parent 5ccb899264
commit 86505c19e2

View File

@ -762,7 +762,7 @@ function multiRemove () {
const files: IResult<ImgInfo>[] = []
const imageIDList = Object.keys(choosedList)
const isDeleteCloudFile = await getConfig('settings.deleteCloudFile')
const picBedsCanbeDeleted = ['smms', 'github', 'imgur', 'tcyun', 'aliyun', 'qiniu', 'upyun']
const picBedsCanbeDeleted = ['smms', 'github', 'imgur', 'tcyun', 'aliyun', 'qiniu', 'upyun', 'aws-s3', 'webdavplist']
if (isDeleteCloudFile) {
for (let i = 0; i < imageIDList.length; i++) {
const key = imageIDList[i]
@ -770,15 +770,16 @@ function multiRemove () {
const file = await $$db.getById<ImgInfo>(key)
if (file) {
if (file.type !== undefined && picBedsCanbeDeleted.includes(file.type)) {
setTimeout(() => {
ALLApi.delete(file).then((value: boolean) => {
if (value) {
const result = await ALLApi.delete(file)
if (result) {
ElNotification({
title: $T('GALLERY_SYNC_DELETE'),
message: `${file.fileName} ${$T('GALLERY_SYNC_DELETE_NOTICE_SUCCEED')}`,
type: 'success',
duration: multiRemoveNumber > 5 ? 1000 : 2000
})
files.push(file)
await $$db.removeById(key)
} else {
ElNotification({
title: $T('GALLERY_SYNC_DELETE'),
@ -787,11 +788,7 @@ function multiRemove () {
duration: multiRemoveNumber > 5 ? 1000 : 2000
})
}
})
}, 0)
}
files.push(file)
await $$db.removeById(key)
}
}
}