Skip to content

Commit 6771c9c

Browse files
committed
Merge branch 'feature/sigit-reset-password' into development
2 parents 09295c2 + 6a2a6ef commit 6771c9c

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

crates/smbcloud-model/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub mod login;
66
pub mod oauth;
77
pub mod project;
88
pub mod repository;
9+
pub mod reset_password_response;
910
pub mod runner;
1011
pub mod signup;
1112

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use {
2+
serde::{Deserialize, Serialize},
3+
tsync::tsync,
4+
};
5+
6+
#[derive(Debug, Serialize, Deserialize)]
7+
#[tsync]
8+
pub struct ResetPasswordResponse {
9+
pub code: Option<i32>,
10+
pub message: String,
11+
}

crates/smbcloud-network/src/network.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub async fn parse_error_response<T: DeserializeOwned>(
7171
println!();
7272
}
7373

74-
let error_response = match serde_json::from_str::<T>(&error_response_body) {
74+
let error_response = match serde_json::from_str(&error_response_body) {
7575
Ok(error_response) => error_response,
7676
Err(e) => {
7777
error!("Failed to parse error response: {:?}", e);
@@ -82,7 +82,8 @@ pub async fn parse_error_response<T: DeserializeOwned>(
8282
}
8383
};
8484
// The parsing itself is succeed.
85-
Ok(error_response)
85+
// Why is this an ErrorResponse.
86+
Err(error_response)
8687
}
8788

8889
pub async fn request_login(builder: RequestBuilder) -> Result<AccountStatus, ErrorResponse> {

crates/smbcloud-networking-account/src/reset_password.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use {
33
smbcloud_model::{
44
error_codes::ErrorResponse,
55
forgot::{Param, UserUpdatePassword},
6+
reset_password_response::ResetPasswordResponse,
67
},
78
smbcloud_network::{environment::Environment, network::request},
89
smbcloud_networking::{
@@ -15,7 +16,7 @@ pub async fn reset_password(
1516
client: SmbClient,
1617
token: String,
1718
password: String,
18-
) -> Result<(), ErrorResponse> {
19+
) -> Result<ResetPasswordResponse, ErrorResponse> {
1920
let password_confirmation = password.clone();
2021
let params = Param {
2122
user: UserUpdatePassword {

0 commit comments

Comments
 (0)