Skip to content

Commit

Permalink
Updated helper to be called by researchers
Browse files Browse the repository at this point in the history
  • Loading branch information
okaycj committed Feb 15, 2024
1 parent 8ef2555 commit 31e9884
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions packages/lookit-helpers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import api from "@lookit/lookit-api";

async function child(uuid: string) {
const child = await api.retrieveChild(uuid);
const { given_name, birthday, age_at_birth, additional_information } =
child.attributes;
return { given_name, birthday, age_at_birth, additional_information };
}
class Helpers {
child_uuid: string;
response_uuid: string;

constructor(child_uuid: string, response_uuid: string) {
this.child_uuid = child_uuid;
this.response_uuid = response_uuid;
}

async child() {
const child = await api.retrieveChild(this.child_uuid);
const { given_name, birthday, age_at_birth, additional_information } =
child.attributes;
return { given_name, birthday, age_at_birth, additional_information };
}

async function pastSessions(response_uuid: string) {
return await api.retrievePastSessions(response_uuid);
async pastSessions() {
return await api.retrievePastSessions(this.response_uuid);
}
}

export default { child, pastSessions };
export default Helpers;

0 comments on commit 31e9884

Please sign in to comment.