Skip to content

Commit 2f8b4a9

Browse files
committed
fix: update exam_mode_hosts endpoint
1 parent 6ee780c commit 2f8b4a9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/pages/api/active.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ function getHostName(ip: string) {
4747
async function getHostsInExamMode() {
4848
try {
4949
// The URL below is only accessible from allowed IP ranges. Ask Codam IT for access if developing locally and you get a 403 error
50-
const response = await fetch("https://exam-rebooter.codam.nl/exam_mode_hosts");
51-
const hosts = await response.json();
52-
if ("error" in hosts) {
53-
throw new Error(hosts["error"]);
50+
const request = await fetch("https://clusterdata.codam.nl/api/exam_mode_hosts");
51+
const response = await request.json();
52+
if ("error" in response) {
53+
throw new Error(response["error"]);
5454
}
55-
// Translate object into an array (only keep values of true)
56-
return Object.keys(hosts).filter((key) => hosts[key] == true);
55+
return response["exam_mode_hosts"];
5756
}
5857
catch (err) {
5958
console.log("Failed to fetch hosts in exam mode: " + err);

0 commit comments

Comments
 (0)