mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-07 23:51:41 +08:00
✨ Feature(custom): refactor all main ipc event
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
import { deleteFailedLog, getRawData } from '@/utils/common'
|
||||
import { getRawData, triggerRPC } from '@/utils/common'
|
||||
import { removeFileFromS3InMain } from '~/utils/deleteFunc'
|
||||
import { deleteFailedLog } from '#/utils/deleteLog'
|
||||
import { IRPCActionType } from '#/types/enum'
|
||||
|
||||
export default class AwsS3Api {
|
||||
static async delete (configMap: IStringKeyMap): Promise<boolean> {
|
||||
try {
|
||||
return ipcRenderer
|
||||
? await ipcRenderer.invoke('delete-aws-s3-file',
|
||||
getRawData(configMap)
|
||||
)
|
||||
? await triggerRPC(IRPCActionType.GALLERY_DELETE_AWS_S3_FILE, getRawData(configMap)) || false
|
||||
: await removeFileFromS3InMain(getRawData(configMap))
|
||||
} catch (error: any) {
|
||||
deleteFailedLog(configMap.fileName, 'AWS S3', error)
|
||||
|
||||
Reference in New Issue
Block a user