1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 03:56:59 +00:00

feat: use native fetch

This commit is contained in:
James Cook 2023-05-30 18:37:24 +01:00
parent 00e3a13821
commit 6552c282d5
6 changed files with 13 additions and 92 deletions

View file

@ -1,7 +1,6 @@
import { API_BASE_STUDENT, BASE_URL } from "../utils/consts.js";
import { BaseClient } from "./baseClient.js";
import { parseCookies } from "../utils/utils.js";
import ky from "ky-universal";
/**
* Student Client
@ -40,11 +39,10 @@ export class StudentClient extends BaseClient {
formData.append("dob", this.dateOfBirth);
formData.append("remember_me", "1");
formData.append("recaptcha-token", "no-token-available");
const request = await ky(BASE_URL + "/student/login", {
const request = await fetch(BASE_URL + "/student/login", {
method: "POST",
body: formData,
redirect: "manual",
throwHttpErrors: false,
credentials: undefined,
});
if (request.status != 302 || !request.headers.get("set-cookie")) {