Skip to content

refactor saving local code to IndexedDB #123

@himself65

Description

@himself65

const getLocalCodeList = () => {
try {
const result = localStorage.getItem('localNameList');
if (result) {
const list = JSON.parse(result) as string[];
const newLocalList = [];
for (let i = 0; i < list.length; i++) {
if (list[i] !== 'localNameList') {
newLocalList.push({
description: list[i],
source: localStorage.getItem(list[i]) as string
});
}
}
//console.log(newLocalList);
setLocalList(newLocalList);
} else {
localStorage.setItem('localNameList', JSON.stringify(['localNameList']));
}
} catch (err) {
throw new Error("Error while getting local code list: " + err);
}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions