fixed form state removed, but not won, aint working yet
This commit is contained in:
@@ -18,7 +18,6 @@ pub async fn handle_command_event(
|
||||
app_state: &mut AppState,
|
||||
login_state: &LoginState,
|
||||
register_state: &RegisterState,
|
||||
form_state: &mut FormState,
|
||||
command_input: &mut String,
|
||||
command_message: &mut String,
|
||||
grpc_client: &mut GrpcClient,
|
||||
@@ -38,7 +37,6 @@ pub async fn handle_command_event(
|
||||
if config.is_command_execute(key.code, key.modifiers) {
|
||||
return process_command(
|
||||
config,
|
||||
form_state,
|
||||
app_state,
|
||||
login_state,
|
||||
register_state,
|
||||
@@ -73,7 +71,6 @@ pub async fn handle_command_event(
|
||||
|
||||
async fn process_command(
|
||||
config: &Config,
|
||||
form_state: &mut FormState,
|
||||
app_state: &mut AppState,
|
||||
login_state: &LoginState,
|
||||
register_state: &RegisterState,
|
||||
@@ -103,7 +100,6 @@ async fn process_command(
|
||||
action,
|
||||
terminal,
|
||||
app_state,
|
||||
form_state,
|
||||
login_state,
|
||||
register_state,
|
||||
)
|
||||
@@ -118,7 +114,6 @@ async fn process_command(
|
||||
"save" => {
|
||||
let outcome = save(
|
||||
app_state,
|
||||
form_state,
|
||||
grpc_client,
|
||||
).await?;
|
||||
let message = match outcome {
|
||||
@@ -131,7 +126,7 @@ async fn process_command(
|
||||
},
|
||||
"revert" => {
|
||||
let message = revert(
|
||||
form_state,
|
||||
app_state,
|
||||
grpc_client,
|
||||
).await?;
|
||||
command_input.clear();
|
||||
|
||||
@@ -15,13 +15,12 @@ impl CommandHandler {
|
||||
&mut self,
|
||||
action: &str,
|
||||
terminal: &mut TerminalCore,
|
||||
app_state: &AppState,
|
||||
form_state: &FormState,
|
||||
app_state: &mut AppState,
|
||||
login_state: &LoginState,
|
||||
register_state: &RegisterState,
|
||||
) -> Result<(bool, String)> {
|
||||
match action {
|
||||
"quit" => self.handle_quit(terminal, app_state, form_state, login_state, register_state).await,
|
||||
"quit" => self.handle_quit(terminal, app_state, login_state, register_state).await,
|
||||
"force_quit" => self.handle_force_quit(terminal).await,
|
||||
"save_and_quit" => self.handle_save_quit(terminal).await,
|
||||
_ => Ok((false, format!("Unknown command: {}", action))),
|
||||
@@ -31,8 +30,7 @@ impl CommandHandler {
|
||||
async fn handle_quit(
|
||||
&self,
|
||||
terminal: &mut TerminalCore,
|
||||
app_state: &AppState,
|
||||
form_state: &FormState,
|
||||
app_state: &mut AppState,
|
||||
login_state: &LoginState,
|
||||
register_state: &RegisterState,
|
||||
) -> Result<(bool, String)> {
|
||||
@@ -41,8 +39,10 @@ impl CommandHandler {
|
||||
login_state.has_unsaved_changes()
|
||||
} else if app_state.ui.show_register {
|
||||
register_state.has_unsaved_changes()
|
||||
} else if let Some(fs) = app_state.form_state_mut() {
|
||||
fs.has_unsaved_changes
|
||||
} else {
|
||||
form_state.has_unsaved_changes
|
||||
false
|
||||
};
|
||||
|
||||
if !has_unsaved {
|
||||
|
||||
Reference in New Issue
Block a user