login waiting dialog works, THIS COMMIT NEEDS TO BE REFACTORED
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::services::auth::AuthClient;
|
||||
use crate::config::binds::config::Config;
|
||||
use crate::ui::handlers::rat_state::UiStateHandler;
|
||||
use crate::ui::handlers::context::UiContext;
|
||||
use crate::ui::handlers::context::DialogPurpose;
|
||||
use crate::functions::common::buffer;
|
||||
use crate::tui::{
|
||||
terminal::core::TerminalCore,
|
||||
@@ -226,11 +227,21 @@ impl EventHandler {
|
||||
message = format!("Intro Option {} selected", index);
|
||||
}
|
||||
UiContext::Login => {
|
||||
message = match index {
|
||||
0 => login::save(auth_state, login_state, &mut self.auth_client, app_state).await?,
|
||||
let login_action_message = match index {
|
||||
0 => { // Index 0 corresponds to the "Login" button
|
||||
match login::initiate_login(app_state, login_state).await {
|
||||
Ok(outcome) => return Ok(outcome),
|
||||
Err(e) => {
|
||||
app_state.show_dialog("Error", &format!("Failed to initiate login: {}", e), vec!["OK".to_string()], DialogPurpose::LoginFailed);
|
||||
login_state.login_request_pending = false;
|
||||
"Error initiating login".to_string()
|
||||
}
|
||||
}
|
||||
},
|
||||
1 => login::back_to_main(login_state, app_state, buffer_state).await,
|
||||
_ => "Invalid Login Option".to_string(),
|
||||
};
|
||||
message = login_action_message;
|
||||
}
|
||||
UiContext::Register => {
|
||||
message = match index {
|
||||
|
||||
Reference in New Issue
Block a user