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

Misplaced header fix and format

This commit is contained in:
Isaac Hatton 2023-10-08 18:16:11 +00:00
parent e48e30428a
commit 0ae750e4b4

View file

@ -88,28 +88,31 @@ export class ParentClient extends BaseClient {
} }
throw new Error("No pupil with specified ID returned"); throw new Error("No pupil with specified ID returned");
} }
/** /**
* Changes the login password for the current parent account * Changes the login password for the current parent account
* @param currentPassword Current password * @param currentPassword Current password
* @param newPassword New password * @param newPassword New password
* @returns Whether the request was successful * @returns Whether the request was successful
*/ */
async changePassword(currentPassword: string, newPassword: string): Promise<ChangePasswordResponse> { async changePassword(
const formData = new URLSearchParams(); currentPassword: string,
formData.append("current", current); newPassword: string,
formData.append("new", newPassword); ): Promise<ChangePasswordResponse> {
formData.append("repeat", newPassword); const formData = new URLSearchParams();
"Content-Type": "application/x-www-form-urlencoded", formData.append("current", currentPassword);
}); formData.append("new", newPassword);
return ( formData.append("repeat", newPassword);
await this.makeAuthedRequest( return (
this.API_BASE + "/password", await this.makeAuthedRequest(
{ this.API_BASE + "/password",
method: "POST", {
body: formData, method: "POST",
headers: headers, body: formData,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
}, },
) },
); )
} );
}
} }