aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-10-21 20:23:11 -0300
committerSebastian <sebasjm@gmail.com>2023-10-21 20:23:11 -0300
commit4b98b693d696d90f30f0a6546b0e1f4bc181a5f2 (patch)
tree3a02b98c89ca60f33b9324a5a08865ba612ffa5e /packages/taler-util
parentd783cdc82b5e1c1c90cc13ee15e04381935fcbf8 (diff)
add missing response code
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/http-client/bank-core.ts6
-rw-r--r--packages/taler-util/src/http-client/types.ts5
2 files changed, 9 insertions, 2 deletions
diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts
index 033b78f67..c49a094e4 100644
--- a/packages/taler-util/src/http-client/bank-core.ts
+++ b/packages/taler-util/src/http-client/bank-core.ts
@@ -166,7 +166,7 @@ export class TalerCoreBankHttpClient {
*
*/
async updatePassword(auth: UserAndToken, body: TalerCorebankApi.AccountPasswordChange) {
- const url = new URL(`accounts/${auth.username}`, this.baseUrl);
+ const url = new URL(`accounts/${auth.username}/auth`, this.baseUrl);
const resp = await this.httpLib.fetch(url.href, {
method: "PATCH",
body,
@@ -179,6 +179,8 @@ export class TalerCoreBankHttpClient {
//FIXME: missing in docs
case HttpStatusCode.NotFound: return opKnownFailure("not-found", resp);
//FIXME: missing in docs
+ case HttpStatusCode.Unauthorized: return opKnownFailure("no-rights", resp);
+ //FIXME: missing in docs
case HttpStatusCode.Forbidden: return opKnownFailure("unauthorized", resp);
default: return opUnknownFailure(resp, await resp.text())
}
@@ -241,6 +243,8 @@ export class TalerCoreBankHttpClient {
});
switch (resp.status) {
case HttpStatusCode.Ok: return opSuccess(resp, codecForAccountData())
+ //FIXME: missing in docs (401 when not found?)
+ case HttpStatusCode.Unauthorized: return opKnownFailure("not-found", resp);
//FIXME: missing in docs
case HttpStatusCode.NotFound: return opKnownFailure("not-found", resp);
//FIXME: missing in docs
diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts
index 5a76981df..b0d6c163b 100644
--- a/packages/taler-util/src/http-client/types.ts
+++ b/packages/taler-util/src/http-client/types.ts
@@ -1017,9 +1017,12 @@ export namespace TalerCorebankApi {
export interface AccountPasswordChange {
-
+ // FIXME: missing in docs
// New password.
new_password: string;
+ // Old password. If present, chec that the old password matches.
+ // Optional for admin account.
+ old_password?: string;
}
export interface PublicAccountsResponse {