This commit is contained in:
Vanessa 2023-01-01 14:09:23 +08:00
parent abdb091c17
commit 2f58714b79
2 changed files with 5 additions and 5 deletions

View file

@ -141,14 +141,14 @@ export const hotKey2Electron = (key: string) => {
export const setLocalStorage = (data?: IWebSocketData) => {
if (data) {
setDefaultStorage(data)
setDefaultStorage(data);
} else {
fetchPost("/api/storage/getLocalStorage", undefined, (response) => {
setDefaultStorage(response)
setDefaultStorage(response);
});
}
};
const setDefaultStorage = (response: IWebSocketData) => {
window.siyuan.storage = response.data;
// 历史数据迁移
@ -218,7 +218,7 @@ const setDefaultStorage = (response: IWebSocketData) => {
window.siyuan.storage[key] = defaultStorage[key];
}
});
}
};
export const exportLocalStorage = (cb?: () => void) => {
fetchPost("/api/storage/setLocalStorage", {val: window.siyuan.storage}, () => {