revert works on login, now do the same for other pages as well
This commit is contained in:
@@ -9,6 +9,7 @@ use crate::ui::handlers::context::DialogPurpose;
|
||||
use common::proto::komp_ac::auth::LoginResponse;
|
||||
use crate::pages::login::LoginFormState;
|
||||
use crate::state::pages::auth::UserRole;
|
||||
use canvas::DataProvider;
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use tokio::spawn;
|
||||
use tokio::sync::mpsc;
|
||||
@@ -108,7 +109,19 @@ pub async fn revert(
|
||||
login_state: &mut LoginFormState,
|
||||
app_state: &mut AppState,
|
||||
) -> String {
|
||||
// Clear the underlying state
|
||||
login_state.clear();
|
||||
|
||||
// Also clear values inside the editor’s data provider
|
||||
{
|
||||
let dp = login_state.editor.data_provider_mut();
|
||||
dp.set_field_value(0, "".to_string());
|
||||
dp.set_field_value(1, "".to_string());
|
||||
dp.set_current_field(0);
|
||||
dp.set_current_cursor_pos(0);
|
||||
dp.set_has_unsaved_changes(false);
|
||||
}
|
||||
|
||||
app_state.hide_dialog();
|
||||
"Login reverted".to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user