back to main
This commit is contained in:
@@ -117,13 +117,7 @@ impl EventHandler {
|
|||||||
UiContext::Login => {
|
UiContext::Login => {
|
||||||
message = match index {
|
message = match index {
|
||||||
0 => login::save(auth_state, &mut self.auth_client, app_state).await?,
|
0 => login::save(auth_state, &mut self.auth_client, app_state).await?,
|
||||||
1 => {
|
1 => login::back_to_main(auth_state, app_state).await,
|
||||||
let msg = login::revert(auth_state, app_state).await;
|
|
||||||
// Optional: Add navigation logic here if revert should change screen
|
|
||||||
// app_state.ui.show_login = false;
|
|
||||||
// app_state.ui.show_intro = true;
|
|
||||||
msg
|
|
||||||
}
|
|
||||||
_ => "Invalid Login Option".to_string(),
|
_ => "Invalid Login Option".to_string(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,29 @@ pub async fn revert(
|
|||||||
auth_state.error_message = None;
|
auth_state.error_message = None;
|
||||||
auth_state.set_has_unsaved_changes(false);
|
auth_state.set_has_unsaved_changes(false);
|
||||||
|
|
||||||
// Ensure dialog is hidden if revert is called
|
|
||||||
// _app_state.hide_dialog(); // Uncomment if needed
|
|
||||||
|
|
||||||
// Navigation logic (currently disabled in original code)
|
|
||||||
// _app_state.ui.show_login = false;
|
|
||||||
// _app_state.ui.show_intro = true;
|
|
||||||
|
|
||||||
"Login reverted".to_string()
|
"Login reverted".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn back_to_main(
|
||||||
|
auth_state: &mut AuthState,
|
||||||
|
app_state: &mut AppState,
|
||||||
|
) -> String {
|
||||||
|
// Clear the input fields
|
||||||
|
auth_state.username.clear();
|
||||||
|
auth_state.password.clear();
|
||||||
|
auth_state.error_message = None;
|
||||||
|
auth_state.set_has_unsaved_changes(false);
|
||||||
|
|
||||||
|
// Ensure dialog is hidden if revert is called
|
||||||
|
app_state.hide_dialog(); // Uncomment if needed
|
||||||
|
|
||||||
|
// Navigation logic (currently disabled in original code)
|
||||||
|
app_state.ui.show_login = false;
|
||||||
|
app_state.ui.show_intro = true;
|
||||||
|
|
||||||
|
// Reset focus state
|
||||||
|
app_state.ui.focus_outside_canvas = false;
|
||||||
|
app_state.general.selected_item = 0;
|
||||||
|
|
||||||
|
"Returned to main menu".to_string()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user