aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src
diff options
context:
space:
mode:
authorHsiangNianian <i@jyunko.cn>2026-01-14 14:55:27 +0800
committerHsiangNianian <i@jyunko.cn>2026-01-14 14:55:27 +0800
commitd915fc26829e7ed68413a3c7556befcd0163a181 (patch)
tree82507970481d4482c75e6f1454d72b378910e63c /src-tauri/src
parent986e76df89028e37ea3f872f12508763b5723e32 (diff)
downloadDropOut-d915fc26829e7ed68413a3c7556befcd0163a181.tar.gz
DropOut-d915fc26829e7ed68413a3c7556befcd0163a181.zip
refactor: simplify default implementations for AccountStore and MsRefreshTokenState
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/core/account_storage.rs9
-rw-r--r--src-tauri/src/core/auth.rs6
-rw-r--r--src-tauri/src/main.rs6
3 files changed, 10 insertions, 11 deletions
diff --git a/src-tauri/src/core/account_storage.rs b/src-tauri/src/core/account_storage.rs
index 9512213..5ab86e4 100644
--- a/src-tauri/src/core/account_storage.rs
+++ b/src-tauri/src/core/account_storage.rs
@@ -5,19 +5,12 @@ use std::path::PathBuf;
/// Stored account data for persistence
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Default)]
pub struct AccountStore {
pub accounts: Vec<StoredAccount>,
pub active_account_id: Option<String>,
}
-impl Default for AccountStore {
- fn default() -> Self {
- Self {
- accounts: Vec::new(),
- active_account_id: None,
- }
- }
-}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs
index e53c00e..5f01a58 100644
--- a/src-tauri/src/core/auth.rs
+++ b/src-tauri/src/core/auth.rs
@@ -115,7 +115,7 @@ pub async fn refresh_microsoft_token(refresh_token: &str) -> Result<TokenRespons
let resp = client
.post(url)
.header("Content-Type", "application/x-www-form-urlencoded")
- .body(serde_urlencoded::to_string(&params).map_err(|e| e.to_string())?)
+ .body(serde_urlencoded::to_string(params).map_err(|e| e.to_string())?)
.send()
.await
.map_err(|e| e.to_string())?;
@@ -225,7 +225,7 @@ pub async fn start_device_flow() -> Result<DeviceCodeResponse, String> {
let resp = client
.post(url)
.header("Content-Type", "application/x-www-form-urlencoded")
- .body(serde_urlencoded::to_string(&params).map_err(|e| e.to_string())?)
+ .body(serde_urlencoded::to_string(params).map_err(|e| e.to_string())?)
.send()
.await
.map_err(|e| e.to_string())?;
@@ -261,7 +261,7 @@ pub async fn exchange_code_for_token(device_code: &str) -> Result<TokenResponse,
let resp = client
.post(url)
.header("Content-Type", "application/x-www-form-urlencoded")
- .body(serde_urlencoded::to_string(&params).map_err(|e| e.to_string())?)
+ .body(serde_urlencoded::to_string(params).map_err(|e| e.to_string())?)
.send()
.await
.map_err(|e| e.to_string())?;
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 8233810..ae74a03 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -26,6 +26,12 @@ pub struct MsRefreshTokenState {
pub token: Mutex<Option<String>>,
}
+impl Default for MsRefreshTokenState {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl MsRefreshTokenState {
pub fn new() -> Self {
Self {