mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
make it work
This commit is contained in:
parent
e584bebb5e
commit
0a9382ebd0
3 changed files with 10 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -117,4 +117,5 @@ dist
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
tests/config.json
|
tests/config.json
|
||||||
|
tests/sandbox.js
|
||||||
|
|
@ -58,10 +58,16 @@ export class ClasschartsStudentClient extends ClasschartsClient {
|
||||||
const user = await this.getStudentInfo();
|
const user = await this.getStudentInfo();
|
||||||
this.studentId = user.id;
|
this.studentId = user.id;
|
||||||
this.studentName = user.name;
|
this.studentName = user.name;
|
||||||
|
const pingFormData = new URLSearchParams();
|
||||||
|
pingFormData.append("include_data", "true");
|
||||||
const pingData = await this.makeAuthedRequest(
|
const pingData = await this.makeAuthedRequest(
|
||||||
this.API_BASE + "/ping",
|
this.API_BASE + "/ping",
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "POST",
|
||||||
|
data: pingFormData.toString(),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ includeMeta: true }
|
{ includeMeta: true }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ test("client returns activity data", () => {
|
||||||
|
|
||||||
test("client returns full activity", () => {
|
test("client returns full activity", () => {
|
||||||
return client
|
return client
|
||||||
.getFullActivity({ from: "2000-01-01", to: "2022-01-01" })
|
.getFullActivity({ from: "2022-01-01", to: "2022-09-01" })
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
let valid = false;
|
let valid = false;
|
||||||
if (data.length > 50) valid = true;
|
if (data.length > 50) valid = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue