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:
parent
8609ff4ba6
commit
ecbbc4777b
5 changed files with 24 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue