Change UserMeta: User instead of Option<User>
I do not know why I have made it optional in the first place. hm
This commit is contained in:
parent
dde43d9752
commit
972100af65
|
@ -63,7 +63,7 @@ pub mod login {
|
|||
login_result.token,
|
||||
cloned_limits,
|
||||
login_result.settings,
|
||||
Some(object),
|
||||
object,
|
||||
);
|
||||
|
||||
Ok(user)
|
||||
|
|
|
@ -71,7 +71,7 @@ pub mod register {
|
|||
token.clone(),
|
||||
cloned_limits,
|
||||
settings,
|
||||
Some(user_object),
|
||||
user_object,
|
||||
);
|
||||
Ok(user)
|
||||
}
|
||||
|
|
|
@ -72,10 +72,7 @@ impl UserMeta {
|
|||
Err(e) => return Err(e),
|
||||
};
|
||||
let user_updated: User = from_str(&result.text().await.unwrap()).unwrap();
|
||||
let _ = std::mem::replace(
|
||||
&mut self.object.as_mut().unwrap(),
|
||||
&mut user_updated.clone(),
|
||||
);
|
||||
let _ = std::mem::replace(&mut self.object, user_updated.clone());
|
||||
Ok(user_updated)
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ pub struct UserMeta {
|
|||
pub token: String,
|
||||
pub limits: Limits,
|
||||
pub settings: UserSettings,
|
||||
pub object: Option<User>,
|
||||
pub object: User,
|
||||
}
|
||||
|
||||
impl UserMeta {
|
||||
|
@ -107,7 +107,7 @@ impl UserMeta {
|
|||
token: String,
|
||||
limits: Limits,
|
||||
settings: UserSettings,
|
||||
object: Option<User>,
|
||||
object: User,
|
||||
) -> UserMeta {
|
||||
UserMeta {
|
||||
belongs_to,
|
||||
|
|
Loading…
Reference in New Issue