diff --git a/client/src/tui/functions/common/login.rs b/client/src/tui/functions/common/login.rs index 72e8f1a..0fd41dc 100644 --- a/client/src/tui/functions/common/login.rs +++ b/client/src/tui/functions/common/login.rs @@ -1,10 +1,12 @@ // src/tui/functions/common/login.rs use crate::services::auth::AuthClient; use crate::state::pages::auth::AuthState; +use crate::state::state::AppState; pub async fn save( auth_state: &mut AuthState, auth_client: &mut AuthClient, + app_state: &mut AppState, ) -> Result> { let identifier = auth_state.username.clone(); let password = auth_state.password.clone(); @@ -15,6 +17,11 @@ pub async fn save( auth_state.user_id = Some(response.user_id); auth_state.role = Some(response.role); auth_state.error_message = None; + + // Update app state to show main interface + app_state.ui.show_login = false; + app_state.ui.show_form = true; + Ok("Login successful!".to_string()) } Err(e) => { @@ -27,9 +34,12 @@ pub async fn save( pub async fn cancel( auth_state: &mut AuthState, + app_state: &mut AppState, ) -> String { auth_state.username.clear(); auth_state.password.clear(); auth_state.error_message = None; + app_state.ui.show_login = false; + app_state.ui.show_intro = true; "Login canceled".to_string() }