1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

chore: deno badge & formatting

This commit is contained in:
James Cook 2023-08-30 13:43:25 +01:00
parent 55d91a52b7
commit 70c9d623fc
6 changed files with 26 additions and 25 deletions

View file

@ -46,14 +46,14 @@ export class StudentClient extends BaseClient {
if (request.status != 302 || !request.headers.get("set-cookie")) {
await request.body?.cancel(); // Make deno tests happy by closing the body, unsure whether this is needed for the actual library
throw new Error(
"Unauthenticated: ClassCharts didn't return authentication cookies"
"Unauthenticated: ClassCharts didn't return authentication cookies",
);
}
const cookies = String(request.headers.get("set-cookie"));
this.authCookies = cookies.split(",");
const sessionCookies = parseCookies(cookies);
const sessionID = JSON.parse(
String(sessionCookies["student_session_credentials"])
String(sessionCookies["student_session_credentials"]),
);
this.sessionId = sessionID.session_id;
await this.getNewSessionId();