mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-25 18:20:24 +08:00
✨ Feature(custom): refactor all main ipc event
This commit is contained in:
16
src/universal/utils/deleteLog.ts
Normal file
16
src/universal/utils/deleteLog.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { ILogType, IRPCActionType } from '#/types/enum'
|
||||
import { sendRPC } from '@/utils/common'
|
||||
|
||||
export const deleteLog = (fileName?: string, type?: string, isSuccess = true, msg?: string) => {
|
||||
ipcRenderer
|
||||
? sendRPC(IRPCActionType.GALLERY_LOG_DELETE_MSG, msg || `Delete ${fileName} on ${type} success`, isSuccess ? ILogType.success : ILogType.error)
|
||||
: console.log(`Delete ${fileName} on ${type} success`)
|
||||
}
|
||||
|
||||
export const deleteFailedLog = (fileName: string, type: string, error: any) => {
|
||||
deleteLog(fileName, type, false)
|
||||
ipcRenderer
|
||||
? sendRPC(IRPCActionType.GALLERY_LOG_DELETE_MSG, error, ILogType.error)
|
||||
: console.error(error)
|
||||
}
|
||||
Reference in New Issue
Block a user