doll active state

This commit is contained in:
2025-12-21 02:08:11 +08:00
parent 7bc73defbc
commit 0e0cb8f33a
6 changed files with 82 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ pub struct UserProfile {
pub created_at: String,
pub updated_at: String,
pub last_login_at: Option<String>,
pub active_doll_id: Option<String>,
}
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
@@ -79,4 +80,18 @@ impl UserRemote {
resp.error_for_status()?;
Ok(())
}
pub async fn set_active_doll(&self, doll_id: &str) -> Result<(), Error> {
let url = format!("{}/users/me/active-doll/{}", self.base_url, doll_id);
let resp = with_auth(self.client.put(url)).await.send().await?;
resp.error_for_status()?;
Ok(())
}
pub async fn remove_active_doll(&self) -> Result<(), Error> {
let url = format!("{}/users/me/active-doll", self.base_url);
let resp = with_auth(self.client.delete(url)).await.send().await?;
resp.error_for_status()?;
Ok(())
}
}