From 80ca0b6800725b6e814a3a07974da796caa03c6a Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Sun, 13 Jun 2021 04:47:27 +0100 Subject: [PATCH] fix: add password in body to adminAddUser --- src/CCashClient.ts | 15 ++++++++++----- src/CCashClient.types.ts | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/CCashClient.ts b/src/CCashClient.ts index 425f280..ad86897 100644 --- a/src/CCashClient.ts +++ b/src/CCashClient.ts @@ -73,7 +73,7 @@ export class CCashClient implements Partial { ); } - setBal(user: string, pass: string, amount: number): Promise { + setBalance(user: string, pass: string, amount: number): Promise { return this.http .patch(`/admin/${user}/bal`, undefined, { headers: { Password: pass }, @@ -120,13 +120,18 @@ export class CCashClient implements Partial { adminAddUser( user: string, pass: string, + initialPass: string, initialBalance: number ): Promise { return this.http - .post(`/user/${user}`, undefined, { - headers: { Password: pass }, - params: { init_bal: initialBalance }, - }) + .post( + `/user/${user}`, + { password: initialPass }, + { + headers: { Password: pass }, + params: { init_bal: initialBalance }, + } + ) .then( (response) => this.handleError(response) || this.serialize(User, { user }) diff --git a/src/CCashClient.types.ts b/src/CCashClient.types.ts index d3b37d7..f06c680 100644 --- a/src/CCashClient.types.ts +++ b/src/CCashClient.types.ts @@ -16,7 +16,7 @@ export interface ICCashClient { // Meta usage changePassword(user: string, pass: string, newPass: string): Promise; - setBal(user: string, pass: string, amount: number): Promise; + setBalance(user: string, pass: string, amount: number): Promise; // System usage help(): Promise; @@ -29,6 +29,7 @@ export interface ICCashClient { adminAddUser( user: string, pass: string, + initialPass: number, initialBalance: number ): Promise; deleteUser(user: string, pass: string): Promise;