fixes for various things

admin routes for adduser and deleteuser
get log
send funds amount: amount
This commit is contained in:
Expand-sys 2021-06-15 17:11:25 +10:00 committed by GitHub
parent 9182240eb9
commit 5741c0061f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ export class CCashClient implements ICCashClient {
log(user: string, pass: string): Promise<number[]> { log(user: string, pass: string): Promise<number[]> {
return this.http return this.http
.get(`/${user}/bal`, { .get(`/${user}/log`, {
headers: { Password: pass }, headers: { Password: pass },
}) })
.then((response) => this.handleError(response) || response.data.value); .then((response) => this.handleError(response) || response.data.value);
@ -43,7 +43,7 @@ export class CCashClient implements ICCashClient {
return this.http return this.http
.post(`/${user}/send/${to}`, undefined, { .post(`/${user}/send/${to}`, undefined, {
headers: { Password: pass }, headers: { Password: pass },
params: { amount }, params: { amount: amount },
}) })
.then((response) => this.handleError(response) || amount); .then((response) => this.handleError(response) || amount);
} }
@ -67,7 +67,7 @@ export class CCashClient implements ICCashClient {
return this.http return this.http
.patch(`/admin/${user}/bal`, undefined, { .patch(`/admin/${user}/bal`, undefined, {
headers: { Password: pass }, headers: { Password: pass },
params: { amount }, params: { amount: amount },
}) })
.then((response) => this.handleError(response) || amount); .then((response) => this.handleError(response) || amount);
} }
@ -118,7 +118,7 @@ export class CCashClient implements ICCashClient {
initialBalance: number initialBalance: number
): Promise<User> { ): Promise<User> {
return this.http return this.http
.post(`/user/${user}`, initialPass, { .post(`/admin/user/${user}`, initialPass, {
headers: { Password: pass }, headers: { Password: pass },
params: { init_bal: initialBalance }, params: { init_bal: initialBalance },
}) })
@ -139,7 +139,7 @@ export class CCashClient implements ICCashClient {
adminDeleteUser(user: string, pass: string): Promise<User> { adminDeleteUser(user: string, pass: string): Promise<User> {
return this.http return this.http
.delete(`/user/${user}`, { headers: { Password: pass } }) .delete(`/admin/user/${user}`, { headers: { Password: pass } })
.then( .then(
(response) => (response) =>
this.handleError(response) || this.serialize(User, { user }) this.handleError(response) || this.serialize(User, { user })