Skip to content

Commit afe1c5b

Browse files
committed
Add LocalStorage Capabilities
The database is made persistent with the help of localStorage and its API's.
1 parent 4726638 commit afe1c5b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import QuestionDatabase from "../DataModel/QuestionDatabase";
2+
3+
function updateQuestionDatabase(updatedDatabase) {
4+
localStorage.setItem("questions", updatedDatabase)
5+
}
6+
7+
function retrieveQuestionDatabase() {
8+
return localStorage.getItem("questions");
9+
}
10+
11+
function setupQuestionDatabase() {
12+
localStorage.setItem("questions", QuestionDatabase());
13+
}
14+
15+
export { setupQuestionDatabase, retrieveQuestionDatabase, updateQuestionDatabase };

0 commit comments

Comments
 (0)