var taToken;

function createLink(url){
    let link = document.createElement("a");
    link.id = "workspaceRedirect";
    link.rel= "noopener noreferrer";
    link.target= "_blank";
    link.href = url;
    link.style = "text-decoration: none;";
    link.innerText = "Go to Workspace";

    return link;
}

function notifyStudent(studentEmail){
    var params = window.location.search + "&studentEmail=" + studentEmail + "&taToken=" + taToken;
    const request = new Request("/notify-student" + params, {method: "POST"});
    
    fetch(request);
}

function endHelp(studentEmail){
    var params = window.location.search + "&studentEmail=" + studentEmail + "&taToken=" + taToken;
    const request = new Request("/end-help" + params, {method: "POST"});
    
    fetch(request).then(() => {
    document.getElementById('beingHelped').innerText = "";
    });
}

function createListElement(studentEmail) {
    let notifyElem = document.createElement("div");
    notifyElem.className = "student-container";

    let student = document.createElement('p');
    student.innerText = studentEmail;
    student.className = "student-info";

    let btn = document.createElement("input");
    btn.value = "notify student you're ready to help";
    btn.type = "button";
    btn.id = studentEmail;
    btn.className = "notify-button";
    btn.onclick = function(){notifyStudent(this.id);};

    notifyElem.appendChild(student);
    notifyElem.appendChild(btn);

    return notifyElem;
}

function createHelpedElem(studentEmail, url){
    let studentElem = document.createElement("div");
    studentElem.className = "help-container";

    let student = document.createElement('p');
    student.innerText = "You are helping " + studentEmail;
    student.className = "help-info";

    let btn = document.createElement("input");
    btn.value = "end interaction";
    btn.type = "button";
    btn.id = studentEmail;
    btn.className = "end-button";
    btn.onclick = function(){endHelp(this.id);};

    studentElem.appendChild(student);
    studentElem.appendChild(btn);
    studentElem.appendChild(createLink(url));

    return studentElem;
}

function getQueue() {
    var params = window.location.search;
    const request = new Request("/get-queue" + params + "&idToken=" + taToken, {method: "GET"});

    fetch(request).then(response => response.json()).then((queue) => {
    const queueListElement = document.getElementById('queue');
    queueListElement.innerText = "";
    queue.queue.forEach((studentEmail) => {
        queueListElement.appendChild(createListElement(studentEmail));
    });

    const beinghelpedElem = document.getElementById('beingHelped');

    if (queue.helping) {
        beinghelpedElem.innerHTML = "";
        document.getElementById('beingHelped').appendChild(createHelpedElem(queue.helping.email, queue.helping.workspace));
    } else {
        beinghelpedElem.innerHTML = "";
    }
    });
}

var repeat = setInterval(getQueue, 1000);
function setToken(token){
    taToken = token;
    getQueue();
}

function getToken() {
    var user = firebase.auth().currentUser;
    firebase.auth().onAuthStateChanged(function(user) {
    if (user) {
        console.log("User is signed in");
        user.getIdToken().then((token) => setToken(token));
    } else {
        console.log("User is not logged in");
        window.location.href = "/"; // Redirect to home page if not logged in
    }
    });
}

function onload() {
    getToken();
    document.getElementById("dashboard-link").href = `/dashboard.html${window.location.search}`;
}
@@ -782,24 +782,28 @@
 hen(() =%3E %7B%0A
+    
     document
@@ -2356,24 +2356,28 @@
 queue) =%3E %7B%0A
+    
     const qu
@@ -2423,24 +2423,28 @@
 d('queue');%0A
+    
     queueLis
@@ -2464,24 +2464,28 @@
 rText = %22%22;%0A
+    
     queue.qu
@@ -2516,32 +2516,36 @@
 l) =%3E %7B%0A        
+    
 queueListElement
@@ -2587,24 +2587,28 @@
 entEmail));%0A
+    
     %7D);%0A%0A   
@@ -2604,24 +2604,28 @@
    %7D);%0A%0A    
+   
+ 
 const beingh
@@ -2673,24 +2673,28 @@
 gHelped');%0A%0A
+    
     if (queu
@@ -2706,32 +2706,36 @@
 ping) %7B%0A        
+ 
+   
 beinghelpedElem.
@@ -2750,32 +2750,36 @@
 L = %22%22;%0A        
+  
+  
 document.getElem
@@ -2874,24 +2874,28 @@
 orkspace));%0A
+    
     %7D else %7B
@@ -2887,32 +2887,36 @@
        %7D else %7B%0A
+    
         beinghel
@@ -2947,45 +2947,33 @@
     
-%7D%0A
     %7D
-);%0A%7D%0A%0Avar repeat = setInterval
+%0A%0A        setTimeout
 (get
@@ -2986,16 +2986,27 @@
  1000);%0A
+    %7D);%0A%7D%0A%0A
 function

Use a timeout instead of a interval in the ta queue.