From 0a9382ebd0a77aa588da8ae363e41f0bc5c059c6 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 23 Sep 2022 18:38:03 +0000 Subject: [PATCH] make it work --- .gitignore | 3 ++- src/studentClient.ts | 8 +++++++- tests/baseClient.test.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e4fd011..815af20 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,5 @@ dist .yarn/install-state.gz .pnp.* -tests/config.json \ No newline at end of file +tests/config.json +tests/sandbox.js \ No newline at end of file diff --git a/src/studentClient.ts b/src/studentClient.ts index e2501a3..5b219ab 100644 --- a/src/studentClient.ts +++ b/src/studentClient.ts @@ -58,10 +58,16 @@ 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: "GET", + method: "POST", + data: pingFormData.toString(), + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, }, { includeMeta: true } ); diff --git a/tests/baseClient.test.ts b/tests/baseClient.test.ts index 94c92ef..cdee8a7 100644 --- a/tests/baseClient.test.ts +++ b/tests/baseClient.test.ts @@ -22,7 +22,7 @@ test("client returns activity data", () => { test("client returns full activity", () => { return client - .getFullActivity({ from: "2000-01-01", to: "2022-01-01" }) + .getFullActivity({ from: "2022-01-01", to: "2022-09-01" }) .then((data) => { let valid = false; if (data.length > 50) valid = true;