diff options
Diffstat (limited to 'atuin-client/src/api_client.rs')
-rw-r--r-- | atuin-client/src/api_client.rs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs index 3999ef80e..d53c9a364 100644 --- a/atuin-client/src/api_client.rs +++ b/atuin-client/src/api_client.rs @@ -10,8 +10,9 @@ use reqwest::{ use atuin_common::{ api::{ - AddHistoryRequest, CountResponse, DeleteHistoryRequest, ErrorResponse, LoginRequest, - LoginResponse, RegisterResponse, StatusResponse, SyncHistoryResponse, ChangePasswordRequest + AddHistoryRequest, ChangePasswordRequest, CountResponse, DeleteHistoryRequest, + ErrorResponse, LoginRequest, LoginResponse, RegisterResponse, StatusResponse, + SyncHistoryResponse, }, record::RecordStatus, }; @@ -360,17 +361,26 @@ impl<'a> Client<'a> { } } - pub async fn change_password(&self, current_password: String, new_password: String) -> Result<()> { + pub async fn change_password( + &self, + current_password: String, + new_password: String, + ) -> Result<()> { let url = format!("{}/account/password", self.sync_addr); let url = Url::parse(url.as_str())?; - let resp = self.client.patch(url).json(&ChangePasswordRequest { - current_password, - new_password - }).send().await?; + let resp = self + .client + .patch(url) + .json(&ChangePasswordRequest { + current_password, + new_password, + }) + .send() + .await?; dbg!(&resp); - + if resp.status() == 401 { bail!("current password is incorrect") } else if resp.status() == 403 { |