mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-31 05:49:39 +08:00
16 lines
611 B
TypeScript
16 lines
611 B
TypeScript
import { IRPCActionType } from '@/utils/enum'
|
|
import type { IObj } from '#/types/types'
|
|
|
|
export function saveConfig(config: IObj | string, value?: any) {
|
|
const configObj = typeof config === 'string' ? { [config]: value } : config
|
|
window.electron.sendRPC(IRPCActionType.MANAGE_SAVE_CONFIG, configObj)
|
|
}
|
|
|
|
export async function getConfig<T>(key?: string): Promise<T | undefined> {
|
|
return await window.electron.triggerRPC<T>(IRPCActionType.MANAGE_GET_CONFIG, key)
|
|
}
|
|
|
|
export function removeConfig(key: string, propName: string) {
|
|
window.electron.sendRPC(IRPCActionType.MANAGE_REMOVE_CONFIG, key, propName)
|
|
}
|