fix get setting with default

This commit is contained in:
Gabe Yuan
2023-09-08 17:10:54 +08:00
parent 117ca4e05b
commit 1ff1b21355

View File

@@ -82,10 +82,8 @@ export const storage = {
* 设置信息 * 设置信息
*/ */
export const getSetting = () => getObj(STOKEY_SETTING); export const getSetting = () => getObj(STOKEY_SETTING);
export const getSettingWithDefault = async () => ({ export const getSettingWithDefault = async () =>
...DEFAULT_SETTING, (await getSetting()) || DEFAULT_SETTING;
...((await getSetting()) || {}),
});
export const setSetting = (val) => setObj(STOKEY_SETTING, val); export const setSetting = (val) => setObj(STOKEY_SETTING, val);
export const updateSetting = (obj) => putObj(STOKEY_SETTING, obj); export const updateSetting = (obj) => putObj(STOKEY_SETTING, obj);