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

fix: client getting logged out (#18)

This commit is contained in:
James Cook 2022-09-23 19:40:32 +01:00 committed by GitHub
parent 8609ff4ba6
commit ecbbc4777b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 8 deletions

View file

@ -58,5 +58,19 @@ export class ClasschartsStudentClient extends ClasschartsClient {
const user = await this.getStudentInfo();
this.studentId = user.id;
this.studentName = user.name;
const pingFormData = new URLSearchParams();
pingFormData.append("include_data", "true");
const pingData = await this.makeAuthedRequest(
this.API_BASE + "/ping",
{
method: "POST",
data: pingFormData.toString(),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
},
{ includeMeta: true }
);
this.sessionId = pingData.meta.session_id;
}
}