common mode register fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// src/modes/canvas/common_mode.rs
|
||||
|
||||
use crate::tui::terminal::core::TerminalCore;
|
||||
use crate::state::pages::{form::FormState, auth::AuthState};
|
||||
use crate::state::pages::{form::FormState, auth::AuthState, auth::RegisterState};
|
||||
use crate::state::state::AppState;
|
||||
use crate::services::grpc_client::GrpcClient;
|
||||
use crate::services::auth::AuthClient;
|
||||
@@ -9,13 +9,15 @@ use crate::modes::handlers::event::EventOutcome;
|
||||
use crate::tui::functions::common::form::SaveOutcome;
|
||||
use crate::tui::functions::common::{
|
||||
form::{save as form_save, revert as form_revert},
|
||||
login::{save as login_save, revert as login_revert}
|
||||
login::{save as login_save, revert as login_revert},
|
||||
register::{save as register_save, revert as register_revert},
|
||||
};
|
||||
|
||||
pub async fn handle_core_action(
|
||||
action: &str,
|
||||
form_state: &mut FormState,
|
||||
auth_state: &mut AuthState,
|
||||
register_state: &mut RegisterState,
|
||||
grpc_client: &mut GrpcClient,
|
||||
auth_client: &mut AuthClient,
|
||||
terminal: &mut TerminalCore,
|
||||
@@ -28,6 +30,9 @@ pub async fn handle_core_action(
|
||||
if app_state.ui.show_login {
|
||||
let message = login_save(auth_state, auth_client, app_state).await?;
|
||||
Ok(EventOutcome::Ok(message))
|
||||
} else if app_state.ui.show_register {
|
||||
let message = register_save(register_state, auth_client, app_state).await?;
|
||||
Ok(EventOutcome::Ok(message))
|
||||
} else {
|
||||
let save_outcome = form_save(
|
||||
form_state,
|
||||
@@ -50,6 +55,8 @@ pub async fn handle_core_action(
|
||||
"save_and_quit" => {
|
||||
let message = if app_state.ui.show_login {
|
||||
login_save(auth_state, auth_client, app_state).await?
|
||||
} else if app_state.ui.show_register {
|
||||
register_save(register_state, auth_client, app_state).await?
|
||||
} else {
|
||||
let save_outcome = form_save(
|
||||
form_state,
|
||||
@@ -70,6 +77,9 @@ pub async fn handle_core_action(
|
||||
if app_state.ui.show_login {
|
||||
let message = login_revert(auth_state, app_state).await;
|
||||
Ok(EventOutcome::Ok(message))
|
||||
} else if app_state.ui.show_register {
|
||||
let message = register_revert(register_state, app_state).await;
|
||||
Ok(EventOutcome::Ok(message))
|
||||
} else {
|
||||
let message = form_revert(
|
||||
form_state,
|
||||
|
||||
@@ -203,6 +203,7 @@ impl EventHandler {
|
||||
action,
|
||||
form_state,
|
||||
auth_state,
|
||||
register_state,
|
||||
grpc_client,
|
||||
&mut self.auth_client,
|
||||
terminal,
|
||||
@@ -286,6 +287,7 @@ impl EventHandler {
|
||||
action,
|
||||
form_state,
|
||||
auth_state,
|
||||
register_state,
|
||||
grpc_client,
|
||||
&mut self.auth_client,
|
||||
terminal,
|
||||
|
||||
Reference in New Issue
Block a user