ui: switch storage to indexeddb

This commit is contained in:
undefined committed 2024-07-03 18:10:40 +08:00
1 parent 70872fe931
commit c996bbfe6d
6 files changed
+102 -42

No files matched your search

@@ -1,6 +1,7 @@
let cacheKey = `${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`;
if (UiContext.tdoc?._id && UiContext.tdoc.rule !== 'homework') cacheKey += `@${UiContext.tdoc._id}`;
// TODO switch to indexeddb
export default function reducer(state = {
lang: localStorage.getItem(`${cacheKey}#lang`) || UiContext.codeLang,
code: localStorage.getItem(cacheKey) || UiContext.codeTemplate,