1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

feat: custom axios config support

This commit is contained in:
James Cook 2022-05-07 12:58:42 +01:00
parent d5b07cffc5
commit 75bc77fc0e
6 changed files with 24 additions and 14 deletions

View file

@ -1,4 +1,4 @@
import axios from "axios";
import axios, { AxiosInstance, AxiosRequestConfig } from "axios";
import type { GetPupilsResponse } from "./types";
import { ClasschartsClient } from "./baseClient";
@ -16,8 +16,12 @@ export class ClasschartsParentClient extends ClasschartsClient {
* @param email Parents email address
* @param password Parents password
*/
constructor(email: string, password: string) {
super(API_BASE_PARENT);
constructor(
email: string,
password: string,
axiosConfig?: AxiosRequestConfig
) {
super(API_BASE_PARENT, axiosConfig);
this.email = String(email);
this.password = String(password);
}
@ -34,7 +38,7 @@ export class ClasschartsParentClient extends ClasschartsClient {
formData.append("password", this.password);
formData.append("recaptcha-token", "no-token-avaliable");
const request = await axios.request({
const request = await this.axios.request({
url: BASE_URL + "/parent/login",
method: "POST",
data: formData.toString(),