🔨 Refactor: refactor some util func

This commit is contained in:
萌萌哒赫萝
2023-05-11 12:52:35 +08:00
parent 80057c8561
commit 12be9d5802
3 changed files with 7 additions and 31 deletions

View File

@@ -11,14 +11,6 @@ export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
}
}
export const trimValues = (obj: IStringKeyMap) => {
const newObj = {} as IStringKeyMap
Object.keys(obj).forEach(key => {
newObj[key] = typeof obj[key] === 'string' ? obj[key].trim() : obj[key]
})
return newObj
}
/**
* get raw data from reactive or ref
*/

View File

@@ -4,16 +4,9 @@ import { v4 as uuid } from 'uuid'
import { IRPCActionType } from '~/universal/types/enum'
import { getRawData } from './common'
export function saveConfig (_config: IObj | string, value?: any) {
let config
if (typeof _config === 'string') {
config = {
[_config]: value
}
} else {
config = getRawData(_config)
}
ipcRenderer.send(PICGO_SAVE_CONFIG, config)
export function saveConfig (config: IObj | string, value?: any) {
const configObject = typeof config === 'string' ? { [config]: value } : getRawData(config)
ipcRenderer.send(PICGO_SAVE_CONFIG, configObject)
}
export function getConfig<T> (key?: string): Promise<T | undefined> {