A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: keep some configs in local storage on logout (#7436)
01zulfi7689e1a7c535
diff --git a/apps/web/src/stores/user-store.ts b/apps/web/src/stores/user-store.tsindex e4b744ab0..101c06cf8 100644--- a/apps/web/src/stores/user-store.ts+++ b/apps/web/src/stores/user-store.ts@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import createStore from "../common/store";import { db } from "../common/db";import BaseStore from "./index";-import config from "../utils/config";import { EV, EVENTS } from "@notesnook/core";import Config from "../utils/config";import { hashNavigate } from "../navigation";@@ -81,7 +80,7 @@ class UserStore extends BaseStore<UserStore> {state.user = undefined;state.isLoggedIn = false;});- config.clear();+ Config.logout();if (reason) {await ConfirmDialog.show({title: strings.loggedOut(),diff --git a/apps/web/src/utils/config.ts b/apps/web/src/utils/config.tsindex 3cf0aab1f..9c2eb893e 100644--- a/apps/web/src/utils/config.ts+++ b/apps/web/src/utils/config.ts@@ -57,5 +57,30 @@ function has(predicate: (key: string) => boolean) {return false;}-const Config = { set, get, clear, all, has, remove };+function logout() {+ const toKeep = [+ "editorConfig",+ "backupStorageLocation",+ "serverUrls",+ "corsProxy",+ "theme:light",+ "theme:dark",+ "colorScheme",+ "followSystemTheme"+ ];+ const vals = {} as Record<string, any>;++ for (const keep of toKeep) {+ const val = get(keep);+ if (val !== undefined) vals[keep] = val;+ }++ clear();++ for (const key in vals) {+ set(key, vals[key]);+ }+}++const Config = { set, get, clear, all, has, remove, logout };export default Config;