mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
refactor getavailableclasses function
This commit is contained in:
+14
-9
@@ -1698,18 +1698,23 @@ function GetUpcomingAssessments() {
|
|||||||
.then((response) => response.payload);
|
.then((response) => response.payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetActiveClasses() {
|
async function GetActiveClasses() {
|
||||||
let func = fetch(`${location.origin}/seqta/student/load/subjects?`, {
|
try {
|
||||||
|
const response = await fetch(`${location.origin}/seqta/student/load/subjects?`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
body: JSON.stringify({})
|
||||||
},
|
|
||||||
body: JSON.stringify({}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return func
|
if (!response.ok) {
|
||||||
.then((result) => result.json())
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||||
.then((response) => response.payload);
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
return data.payload;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Oops! There was a problem fetching active classes:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function comparedate(obj1, obj2) {
|
function comparedate(obj1, obj2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user