Logout operation (#1087)
This commit is contained in:
committed by
GitHub
parent
538616af54
commit
9f0971f8a9
@@ -33,6 +33,7 @@ fn main() {
|
||||
mixnet::account::create_new_account,
|
||||
mixnet::account::switch_network,
|
||||
mixnet::account::get_balance,
|
||||
mixnet::account::logout,
|
||||
mixnet::admin::get_contract_settings,
|
||||
mixnet::admin::update_contract_settings,
|
||||
mixnet::bond::bond_gateway,
|
||||
|
||||
@@ -112,6 +112,12 @@ pub async fn switch_network(
|
||||
Ok(account)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn logout(state: tauri::State<'_, Arc<RwLock<State>>>) -> Result<(), BackendError> {
|
||||
state.write().await.logout();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn random_mnemonic() -> Mnemonic {
|
||||
let mut rng = rand::thread_rng();
|
||||
Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap()
|
||||
|
||||
@@ -39,6 +39,10 @@ impl State {
|
||||
pub fn set_network(&mut self, network: Network) {
|
||||
self.current_network = network;
|
||||
}
|
||||
|
||||
pub fn logout(&mut self) {
|
||||
self.signing_clients = HashMap::new();
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
||||
Reference in New Issue
Block a user