move AcountData into UserAccount
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -94,7 +94,7 @@ pub fn render_accounts_route(
|
||||
}
|
||||
}
|
||||
AccountsRouteResponse::AddAccount(response) => {
|
||||
let action = process_login_view_response(accounts, decks, col, response);
|
||||
let action = process_login_view_response(accounts, decks, col, ndb, response);
|
||||
*login_state = Default::default();
|
||||
let router = get_active_columns_mut(accounts, decks)
|
||||
.column_mut(col)
|
||||
@@ -144,17 +144,20 @@ pub fn process_login_view_response(
|
||||
manager: &mut Accounts,
|
||||
decks: &mut DecksCache,
|
||||
col: usize,
|
||||
ndb: &Ndb,
|
||||
response: AccountLoginResponse,
|
||||
) -> AddAccountAction {
|
||||
let (r, pubkey) = match response {
|
||||
AccountLoginResponse::CreateNew => {
|
||||
let kp = FullKeypair::generate().to_keypair();
|
||||
let pubkey = kp.pubkey;
|
||||
(manager.add_account(kp), pubkey)
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
(manager.add_account(ndb, &txn, kp), pubkey)
|
||||
}
|
||||
AccountLoginResponse::LoginWith(keypair) => {
|
||||
let pubkey = keypair.pubkey;
|
||||
(manager.add_account(keypair), pubkey)
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
(manager.add_account(ndb, &txn, keypair), pubkey)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -770,9 +770,12 @@ pub fn set_demo(
|
||||
) {
|
||||
let fallback = decks_cache.get_fallback_pubkey();
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
if let Some(resp) =
|
||||
accounts.add_account(Keypair::only_pubkey(*decks_cache.get_fallback_pubkey()))
|
||||
{
|
||||
if let Some(resp) = accounts.add_account(
|
||||
ndb,
|
||||
&txn,
|
||||
Keypair::only_pubkey(*decks_cache.get_fallback_pubkey()),
|
||||
) {
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
resp.unk_id_action.process_action(unk_ids, ndb, &txn);
|
||||
}
|
||||
accounts.select_account(fallback);
|
||||
|
||||
Reference in New Issue
Block a user