compiled
This commit is contained in:
@@ -43,7 +43,7 @@ pub async fn handle_core_action(
|
|||||||
},
|
},
|
||||||
"save_and_quit" => {
|
"save_and_quit" => {
|
||||||
let message = if app_state.ui.show_login {
|
let message = if app_state.ui.show_login {
|
||||||
login_save(auth_state, grpc_client).await?
|
login_save(auth_state, auth_client, app_state).await?
|
||||||
} else {
|
} else {
|
||||||
form_save(
|
form_save(
|
||||||
form_state,
|
form_state,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::tui::terminal::{
|
|||||||
core::TerminalCore,
|
core::TerminalCore,
|
||||||
};
|
};
|
||||||
use crate::services::grpc_client::GrpcClient;
|
use crate::services::grpc_client::GrpcClient;
|
||||||
|
use crate::services::auth::AuthClient;
|
||||||
use crate::tui::functions::common::commands::CommandHandler;
|
use crate::tui::functions::common::commands::CommandHandler;
|
||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::state::pages::form::FormState;
|
use crate::state::pages::form::FormState;
|
||||||
@@ -27,11 +28,12 @@ pub struct EventHandler {
|
|||||||
pub ideal_cursor_column: usize,
|
pub ideal_cursor_column: usize,
|
||||||
pub key_sequence_tracker: KeySequenceTracker,
|
pub key_sequence_tracker: KeySequenceTracker,
|
||||||
pub auth_state: AuthState,
|
pub auth_state: AuthState,
|
||||||
|
pub auth_client: AuthClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventHandler {
|
impl EventHandler {
|
||||||
pub fn new() -> Self {
|
pub async fn new() -> Result<Self, Box<dyn std::error::Error>> {
|
||||||
EventHandler {
|
Ok(EventHandler {
|
||||||
command_mode: false,
|
command_mode: false,
|
||||||
command_input: String::new(),
|
command_input: String::new(),
|
||||||
command_message: String::new(),
|
command_message: String::new(),
|
||||||
@@ -40,7 +42,8 @@ impl EventHandler {
|
|||||||
ideal_cursor_column: 0,
|
ideal_cursor_column: 0,
|
||||||
key_sequence_tracker: KeySequenceTracker::new(800),
|
key_sequence_tracker: KeySequenceTracker::new(800),
|
||||||
auth_state: AuthState::new(),
|
auth_state: AuthState::new(),
|
||||||
}
|
auth_client: AuthClient::new().await?,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_event(
|
pub async fn handle_event(
|
||||||
@@ -133,6 +136,7 @@ impl EventHandler {
|
|||||||
form_state,
|
form_state,
|
||||||
&mut self.auth_state,
|
&mut self.auth_state,
|
||||||
grpc_client,
|
grpc_client,
|
||||||
|
&mut self.auth_client,
|
||||||
terminal,
|
terminal,
|
||||||
app_state,
|
app_state,
|
||||||
current_position,
|
current_position,
|
||||||
@@ -194,6 +198,7 @@ impl EventHandler {
|
|||||||
form_state,
|
form_state,
|
||||||
&mut self.auth_state,
|
&mut self.auth_state,
|
||||||
grpc_client,
|
grpc_client,
|
||||||
|
&mut self.auth_client,
|
||||||
terminal,
|
terminal,
|
||||||
app_state,
|
app_state,
|
||||||
current_position,
|
current_position,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let mut form_state = FormState::new(column_names);
|
let mut form_state = FormState::new(column_names);
|
||||||
|
|
||||||
// The rest of your UI initialization remains the same
|
// The rest of your UI initialization remains the same
|
||||||
let mut event_handler = EventHandler::new();
|
let mut event_handler = EventHandler::new().await?;
|
||||||
let event_reader = EventReader::new();
|
let event_reader = EventReader::new();
|
||||||
|
|
||||||
// Fetch the total count of Adresar entries
|
// Fetch the total count of Adresar entries
|
||||||
|
|||||||
Reference in New Issue
Block a user