This commit is contained in:
filipriec
2025-03-31 17:10:51 +02:00
parent 07c48985e4
commit 060cff3f0f
3 changed files with 10 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ use crate::tui::terminal::{
core::TerminalCore,
};
use crate::services::grpc_client::GrpcClient;
use crate::services::auth::AuthClient;
use crate::tui::functions::common::commands::CommandHandler;
use crate::config::binds::config::Config;
use crate::state::pages::form::FormState;
@@ -27,11 +28,12 @@ pub struct EventHandler {
pub ideal_cursor_column: usize,
pub key_sequence_tracker: KeySequenceTracker,
pub auth_state: AuthState,
pub auth_client: AuthClient,
}
impl EventHandler {
pub fn new() -> Self {
EventHandler {
pub async fn new() -> Result<Self, Box<dyn std::error::Error>> {
Ok(EventHandler {
command_mode: false,
command_input: String::new(),
command_message: String::new(),
@@ -40,7 +42,8 @@ impl EventHandler {
ideal_cursor_column: 0,
key_sequence_tracker: KeySequenceTracker::new(800),
auth_state: AuthState::new(),
}
auth_client: AuthClient::new().await?,
})
}
pub async fn handle_event(
@@ -133,6 +136,7 @@ impl EventHandler {
form_state,
&mut self.auth_state,
grpc_client,
&mut self.auth_client,
terminal,
app_state,
current_position,
@@ -194,6 +198,7 @@ impl EventHandler {
form_state,
&mut self.auth_state,
grpc_client,
&mut self.auth_client,
terminal,
app_state,
current_position,