From 75cd942f393548cc31f4260ddb81a9c4533d0e83 Mon Sep 17 00:00:00 2001 From: filipriec Date: Mon, 7 Apr 2025 23:06:58 +0200 Subject: [PATCH] fixed and now fully functional --- client/src/modes/common/command_mode.rs | 15 ++++++++++++++- client/src/modes/handlers/event.rs | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/modes/common/command_mode.rs b/client/src/modes/common/command_mode.rs index 7f6ac97..7deabdd 100644 --- a/client/src/modes/common/command_mode.rs +++ b/client/src/modes/common/command_mode.rs @@ -4,6 +4,7 @@ use crossterm::event::{KeyEvent, KeyCode, KeyModifiers}; use crate::config::binds::config::Config; use crate::services::grpc_client::GrpcClient; use crate::state::pages::form::FormState; +use crate::state::{state::AppState, pages::auth::AuthState}; use crate::modes::common::commands::CommandHandler; use crate::tui::terminal::core::TerminalCore; use crate::tui::functions::common::form::{save, revert}; @@ -14,6 +15,8 @@ use std::error::Error; pub async fn handle_command_event( key: KeyEvent, config: &Config, + app_state: &AppState, + auth_state: &AuthState, form_state: &mut FormState, command_input: &mut String, command_message: &mut String, @@ -35,6 +38,8 @@ pub async fn handle_command_event( return process_command( config, form_state, + app_state, + auth_state, command_input, command_message, grpc_client, @@ -67,6 +72,8 @@ pub async fn handle_command_event( async fn process_command( config: &Config, form_state: &mut FormState, + app_state: &AppState, + auth_state: &AuthState, command_input: &mut String, command_message: &mut String, grpc_client: &mut GrpcClient, @@ -89,7 +96,13 @@ async fn process_command( match action { "force_quit" | "save_and_quit" | "quit" => { let (should_exit, message) = command_handler - .handle_command(action, terminal) + .handle_command( + action, + terminal, + app_state, + form_state, + auth_state, + ) .await?; command_input.clear(); if should_exit { diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 0232c0b..d1b2790 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -268,6 +268,8 @@ impl EventHandler { let outcome = command_mode::handle_command_event( key, config, + app_state, + auth_state, form_state, &mut self.command_input, &mut self.command_message,