fixing, nothing works lmao

This commit is contained in:
filipriec
2025-04-18 20:48:39 +02:00
parent 5a029283a1
commit d3fcb23e22
18 changed files with 48 additions and 39 deletions

View File

@@ -7,6 +7,7 @@ use crate::services::grpc_client::GrpcClient;
use crate::services::auth::AuthClient;
use crate::modes::handlers::event::EventOutcome;
use crate::tui::functions::common::form::SaveOutcome;
use anyhow::{Context, Result};
use crate::tui::functions::common::{
form::{save as form_save, revert as form_revert},
login::{save as login_save, revert as login_revert},
@@ -25,14 +26,14 @@ pub async fn handle_core_action(
app_state: &mut AppState,
current_position: &mut u64,
total_count: u64,
) -> Result<EventOutcome, Box<dyn std::error::Error>> {
) -> Result<EventOutcome> {
match action {
"save" => {
if app_state.ui.show_login {
let message = login_save(auth_state, login_state, auth_client, app_state).await?;
let message = login_save(auth_state, login_state, auth_client, app_state).await.context("Login save action failed")?;
Ok(EventOutcome::Ok(message))
} else if app_state.ui.show_register {
let message = register_save(register_state, auth_client, app_state).await?;
let message = register_save(register_state, auth_client, app_state).await.context("Register save_and_quit action failed")?;
Ok(EventOutcome::Ok(message))
} else {
let save_outcome = form_save(
@@ -40,7 +41,7 @@ pub async fn handle_core_action(
grpc_client,
current_position,
total_count,
).await?;
).await.context("Register save action failed")?;
let message = match save_outcome {
SaveOutcome::NoChange => "No changes to save.".to_string(),
SaveOutcome::UpdatedExisting => "Entry updated.".to_string(),
@@ -55,9 +56,9 @@ pub async fn handle_core_action(
},
"save_and_quit" => {
let message = if app_state.ui.show_login {
login_save(auth_state, login_state, auth_client, app_state).await?
login_save(auth_state, login_state, auth_client, app_state).await.context("Login save n quit action failed")?
} else if app_state.ui.show_register {
register_save(register_state, auth_client, app_state).await?
register_save(register_state, auth_client, app_state).await.context("Register save n quit action failed")?
} else {
let save_outcome = form_save(
form_state,
@@ -87,7 +88,7 @@ pub async fn handle_core_action(
grpc_client,
current_position,
total_count,
).await?;
).await.context("Form revert x action failed")?;
Ok(EventOutcome::Ok(message))
}
},