mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: scraptchpad localStorage for each user
This commit is contained in:
1 parent
ae0d50d99e
commit
635776c86a
2 files changed
+3
-3
No files matched your search
@@ -1,10 +1,10 @@
|
||||
export default function reducer(state = {
|
||||
lang: UiContext.codeLang,
|
||||
code: localStorage.getItem(`${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`) || UiContext.codeTemplate,
|
||||
code: localStorage.getItem(`${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`) || UiContext.codeTemplate,
|
||||
}, action) {
|
||||
switch (action.type) {
|
||||
case 'SCRATCHPAD_EDITOR_UPDATE_CODE': {
|
||||
localStorage.setItem(`${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`, action.payload);
|
||||
localStorage.setItem(`${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`, action.payload);
|
||||
return {
|
||||
...state,
|
||||
code: action.payload,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.12.14",
|
||||
"version": "4.12.15",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user