mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
style: prettier and eslint
This commit is contained in:
parent
e1ac2b1364
commit
efba7086ea
8 changed files with 33 additions and 2803 deletions
|
|
@ -30,13 +30,12 @@ export class ClasschartsClient {
|
|||
* @param API_BASE Base API URL, this is different depending if its called as a parent or student
|
||||
*/
|
||||
constructor(API_BASE: string) {
|
||||
this.API_BASE = API_BASE
|
||||
this.API_BASE = API_BASE;
|
||||
}
|
||||
public async makeAuthedRequest(
|
||||
path: string,
|
||||
options: Omit<RequestOptions, "origin" | "path">
|
||||
) {
|
||||
|
||||
if (!this.authCookies) throw new Error("Not authenticated");
|
||||
const requestOptions: Omit<RequestOptions, "origin" | "path"> = {
|
||||
...options,
|
||||
|
|
@ -46,7 +45,6 @@ export class ClasschartsClient {
|
|||
},
|
||||
};
|
||||
|
||||
|
||||
const request = await Undici.request(path, requestOptions);
|
||||
|
||||
let responseJSON;
|
||||
|
|
@ -56,14 +54,12 @@ export class ClasschartsClient {
|
|||
throw new Error("Invalid JSON response recieved");
|
||||
}
|
||||
if (responseJSON.success == 0) {
|
||||
|
||||
throw new Error(responseJSON.error);
|
||||
}
|
||||
|
||||
return responseJSON.data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets general information about the logged in student
|
||||
* @returns Student object
|
||||
|
|
@ -94,8 +90,6 @@ export class ClasschartsClient {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the logged in students behaviour points
|
||||
* @param options GetBehaviourOptions
|
||||
|
|
@ -143,7 +137,7 @@ export class ClasschartsClient {
|
|||
data[i].description = data[i].description.replace(/ /g, "");
|
||||
data[i].description = data[i].description.trim();
|
||||
}
|
||||
console.log(data)
|
||||
console.log(data);
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue