From 8dc8448de0b9acaf9c3c27556d3c6c4342d8d493 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 21 May 2024 10:43:08 +0700 Subject: fix(daemon): do not try to sync if logged out (#2037) * fix(daemon): do not try to sync if logged out I've also added Settings::logged_in, as there are a few places where we switch on login state. * make session_token a function --- crates/atuin-client/src/record/sync.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/atuin-client/src/record') diff --git a/crates/atuin-client/src/record/sync.rs b/crates/atuin-client/src/record/sync.rs index 234c6442..c3794b59 100644 --- a/crates/atuin-client/src/record/sync.rs +++ b/crates/atuin-client/src/record/sync.rs @@ -55,7 +55,10 @@ pub async fn diff( ) -> Result<(Vec, RecordStatus), SyncError> { let client = Client::new( &settings.sync_address, - &settings.session_token, + settings + .session_token() + .map_err(|e| SyncError::RemoteRequestError { msg: e.to_string() })? + .as_str(), settings.network_connect_timeout, settings.network_timeout, ) @@ -270,7 +273,10 @@ pub async fn sync_remote( ) -> Result<(i64, Vec), SyncError> { let client = Client::new( &settings.sync_address, - &settings.session_token, + settings + .session_token() + .map_err(|e| SyncError::RemoteRequestError { msg: e.to_string() })? + .as_str(), settings.network_connect_timeout, settings.network_timeout, ) -- cgit v1.3.1