aboutsummaryrefslogtreecommitdiff
path: root/src/database-prod.ts
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-09-25 20:19:08 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-09-25 21:00:13 +0200
commit945f3bdceffed7d3bb20ee1849f5f166b3c467bc (patch)
tree44a32b7b60f04d92480ca4cb6911e7f04150f089 /src/database-prod.ts
parentc2f353da71a02519466ac624be6f8ca909d630b4 (diff)
downloadbycs-sol-945f3bdceffed7d3bb20ee1849f5f166b3c467bc.tar.gz
bycs-sol-945f3bdceffed7d3bb20ee1849f5f166b3c467bc.zip
utils: introduce course local storage helper class
Diffstat (limited to 'src/database-prod.ts')
-rw-r--r--src/database-prod.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database-prod.ts b/src/database-prod.ts
index 6712adb..7f50a35 100644
--- a/src/database-prod.ts
+++ b/src/database-prod.ts
@@ -1,5 +1,5 @@
import { assert } from "./assert.ts";
-import { getCourseId, getSesskey } from "./utils-ENV.js";
+import { getCourseId, CourseLocalStorage, getSesskey } from "./utils-ENV.js";
const DB_TEMPLATE_LIST_HEADER = `
<table class="table table-striped">
@@ -31,7 +31,7 @@ let graduationDb = findGraduationDb();
const ID_QUERY_PARAM_REGEX = /[?&]id=(\d+)/;
async function findGraduationDb() {
- let graduationDbId = localStorage.getItem(`gruaduationDbId-${getCourseId()}`);
+ let graduationDbId = CourseLocalStorage.getItem("bycs-sol-gruaduationDbId");
if (graduationDbId !== null) {
return new DB(Number(graduationDbId));
}
@@ -46,7 +46,7 @@ async function findGraduationDb() {
const match = anchor.href.match(ID_QUERY_PARAM_REGEX);
if (match === null) continue;
const dbId = match[1];
- localStorage.setItem("graduationDbId", dbId);
+ CourseLocalStorage.setItem("bycs-sol-graduationDbId", dbId);
return new DB(Number(dbId));
}
}