From 482c006782c8270801d82e82e113fa5fba6b774d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 28 Sep 2026 15:56:31 +0200 Subject: utils: move get*Id functions into utils-common.ts --- src/utils-mock.js | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'src/utils-mock.js') diff --git a/src/utils-mock.js b/src/utils-mock.js index 4fb2b10..99455f9 100644 --- a/src/utils-mock.js +++ b/src/utils-mock.js @@ -1,10 +1,13 @@ -import { fetchStudentsMock } from "./mock.ts"; +import { fetchStudentsMock, getName } from "./mock.ts"; +export { getName } from "./mock.ts"; export { DATE_FMT, DATETIME_FMT, dateStringNow, datetimeStringNow, + getCourseId, getUserIconUrl, + getUserId, splitmix32, } from "./utils-common.ts"; @@ -23,22 +26,6 @@ export function getFirstAndLastname() { return [firstname, lastname]; } -export function getName() { - let name = ""; - - const params = new URLSearchParams(document.location.search); - if (params.has("firstname")) name = params.get("firstname"); - if (params.has("lastname")) name += " " + params.get("lastname"); - - return name.trim(); -} - -export function getUserId() { - const name = getName(); - - return fetchStudentsMock.filter((s) => s.name === name)[0].id; -} - export function getActivityUrl(name) { switch (name) { case "Cockpit": @@ -48,10 +35,6 @@ export function getActivityUrl(name) { } } -export function getCourseId() { - return "1337"; -} - export function getSesskey() { return "sesskey"; } -- cgit v1.2.3