diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
| commit | 6839831af54cd9302119bcc3bffafe10475958d4 (patch) | |
| tree | 12a1c1fbd864e9579cb9c3a09d4bf4686a280b73 /src/utils-mock.js | |
| parent | fccb70cbd876785f6833dfe6efc10ec9e445556d (diff) | |
| download | bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.tar.gz bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.zip | |
refactor project structure
* merge sites into single project root
* fix name of mass-graduation site
* enable typescript support
Diffstat (limited to 'src/utils-mock.js')
| -rw-r--r-- | src/utils-mock.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/utils-mock.js b/src/utils-mock.js new file mode 100644 index 0000000..e64b59d --- /dev/null +++ b/src/utils-mock.js @@ -0,0 +1,41 @@ +import { fetchStudent } from "./student-ENV.js"; +export { DATE_FMT, DATETIME_FMT, dateStringNow, datetimeStringNow } from "../dist/src/utils-common.js"; + +export function isTeacher() { + return !(new URLSearchParams(document.location.search)).has("student"); +} + +export function getFirstAndLastname() { + let firstname = ""; + let lastname = ""; + + const params = new URLSearchParams(document.location.search); + if (params.has("firstname")) + firstname = params.get("firstname") + if (params.has("lastname")) + lastname = params.get("lastname") + + 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; +} + +export function getUserId() { + const name = getName(); + + return fetchStudent(null, name).id; +} + +export function getCourseId() { + return "1337"; +} |
