@@ -39,7 +39,7 @@ export class ParentClient extends BaseClient {
3939 method : "POST" ,
4040 body : formData ,
4141 headers : headers ,
42- credentials : undefined ,
42+ redirect : "manual" ,
4343 } ) ;
4444 if ( response . status != 302 || ! response . headers . has ( "set-cookie" ) ) {
4545 throw new Error (
@@ -56,19 +56,20 @@ export class ParentClient extends BaseClient {
5656 const sessionID = JSON . parse (
5757 String ( sessionCookies [ "parent_session_credentials" ] ) ,
5858 ) ;
59- super . sessionId = sessionID . session_id ;
59+ this . sessionId = sessionID . session_id ;
6060 this . pupils = await this . getPupils ( ) ;
6161 if ( ! this . pupils ) throw new Error ( "Account has no pupils attached" ) ;
62- super . studentId = this . pupils [ 0 ] . id ;
62+ this . studentId = this . pupils [ 0 ] . id ;
6363 }
6464 /**
6565 * Get a list of pupils connected to this parent's account
6666 * @returns an array of Pupils connected to this parent's account
6767 */
6868 async getPupils ( ) : Promise < GetPupilsResponse > {
69- return await super . makeAuthedRequest ( super . API_BASE + "/pupils" , {
69+ const response = await this . makeAuthedRequest ( this . API_BASE + "/pupils" , {
7070 method : "GET" ,
7171 } ) ;
72+ return response . data ;
7273 }
7374 /**
7475 * Selects a pupil to be used with API requests
@@ -82,7 +83,7 @@ export class ParentClient extends BaseClient {
8283 for ( let i = 0 ; i < pupils . length ; i ++ ) {
8384 const pupil = pupils [ i ] ;
8485 if ( pupil . id == pupilId ) {
85- super . studentId = pupil . id ;
86+ this . studentId = pupil . id ;
8687 return ;
8788 }
8889 }
0 commit comments