diff options
Diffstat (limited to 'src/utils-mock.js')
| -rw-r--r-- | src/utils-mock.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/utils-mock.js b/src/utils-mock.js index e64b59d..ab87ddc 100644 --- a/src/utils-mock.js +++ b/src/utils-mock.js @@ -1,5 +1,11 @@ -import { fetchStudent } from "./student-ENV.js"; -export { DATE_FMT, DATETIME_FMT, dateStringNow, datetimeStringNow } from "../dist/src/utils-common.js"; +import { fetchStudentsMock } from "./mock.ts"; +export { + DATE_FMT, + DATETIME_FMT, + dateStringNow, + datetimeStringNow, + getUserIconUrl +} from "./utils-common.ts"; export function isTeacher() { return !(new URLSearchParams(document.location.search)).has("student"); @@ -11,9 +17,9 @@ export function getFirstAndLastname() { const params = new URLSearchParams(document.location.search); if (params.has("firstname")) - firstname = params.get("firstname") + firstname = params.get("firstname"); if (params.has("lastname")) - lastname = params.get("lastname") + lastname = params.get("lastname"); return [firstname, lastname]; } @@ -23,9 +29,9 @@ export function getName() { const params = new URLSearchParams(document.location.search); if (params.has("firstname")) - name = params.get("firstname") + name = params.get("firstname"); if (params.has("lastname")) - name += params.get("lastname") + name += params.get("lastname"); return name; } @@ -33,9 +39,16 @@ export function getName() { export function getUserId() { const name = getName(); - return fetchStudent(null, name).id; + return fetchStudentsMock.filter((s) => s.name === name )[0].id; } export function getCourseId() { return "1337"; } + +export function getCourseParticipantsUrl() { + console.error("Try to get mocked participations URL"); + return ""; +} + + |
