@@ -359,6 +359,7 @@ export default class ClientStore extends BaseStore {
359359 setLoginId : action . bound ,
360360 setAccounts : action . bound ,
361361 setSwitched : action . bound ,
362+ setUrlParams : action . bound ,
362363 setIsAuthorize : action . bound ,
363364 setIsLoggingIn : action . bound ,
364365 setPreSwitchAccount : action . bound ,
@@ -1065,11 +1066,22 @@ export default class ClientStore extends BaseStore {
10651066 resetLocalStorageValues ( loginid ) {
10661067 this . accounts [ loginid ] . accepted_bch = 0 ;
10671068 LocalStore . setObject ( storage_key , this . accounts ) ;
1068- LocalStore . set ( 'active_loginid' , loginid ) ;
1069+ sessionStorage . setItem ( 'active_loginid' , loginid ) ;
1070+ this . setUrlParams ( ) ;
10691071 this . syncWithLegacyPlatforms ( loginid , toJS ( this . accounts ) ) ;
10701072 this . loginid = loginid ;
10711073 }
10721074
1075+ setUrlParams ( ) {
1076+ const url = new URL ( window . location . href ) ;
1077+ const loginid = sessionStorage . getItem ( 'active_wallet_loginid' ) || sessionStorage . getItem ( 'active_loginid' ) ;
1078+ const account_param = / ^ V R / . test ( loginid ) ? 'demo' : this . accounts [ loginid ] ?. currency ;
1079+ if ( account_param ) {
1080+ url . searchParams . set ( 'account' , account_param ) ;
1081+ window . history . replaceState ( { } , '' , url . toString ( ) ) ;
1082+ }
1083+ }
1084+
10731085 setIsAuthorize ( value ) {
10741086 this . is_authorize = value ;
10751087 }
@@ -1576,7 +1588,7 @@ export default class ClientStore extends BaseStore {
15761588
15771589 if ( [ 'crypto_transactions_withdraw' , 'payment_withdraw' ] . includes ( action_param ) && loginid_param )
15781590 this . setLoginId ( loginid_param ) ;
1579- else this . setLoginId ( LocalStore . get ( 'active_loginid' ) ) ;
1591+ else this . setLoginId ( window . sessionStorage . getItem ( 'active_loginid' ) || LocalStore . get ( 'active_loginid' ) ) ;
15801592 this . user_id = LocalStore . get ( 'active_user_id' ) ;
15811593 this . setAccounts ( LocalStore . getObject ( storage_key ) ) ;
15821594 this . setSwitched ( '' ) ;
@@ -2005,11 +2017,15 @@ export default class ClientStore extends BaseStore {
20052017
20062018 //temporary workaround to sync this.loginid with selected wallet loginid
20072019 if ( window . location . pathname . includes ( routes . wallets ) ) {
2008- this . resetLocalStorageValues ( localStorage . getItem ( 'active_loginid' ) ?? this . loginid ) ;
2020+ this . resetLocalStorageValues (
2021+ window . sessionStorage . getItem ( 'active_loginid' ) ??
2022+ localStorage . getItem ( 'active_loginid' ) ??
2023+ this . loginid
2024+ ) ;
20092025 return ;
20102026 }
20112027
2012- this . resetLocalStorageValues ( this . loginid ) ;
2028+ this . resetLocalStorageValues ( window . sessionStorage . getItem ( 'active_loginid' ) ?? this . loginid ) ;
20132029 }
20142030 }
20152031
@@ -2232,11 +2248,12 @@ export default class ClientStore extends BaseStore {
22322248 if ( active_loginid && Object . keys ( client_object ) . length ) {
22332249 if ( selected_account && is_wallets_selected ) {
22342250 localStorage . setItem ( 'active_wallet_loginid' , active_wallet_loginid ) ;
2251+ sessionStorage . setItem ( 'active_wallet_loginid' , active_wallet_loginid ) ;
22352252 if ( verification_code ) {
22362253 localStorage . setItem ( 'verification_code.payment_withdraw' , verification_code ) ;
22372254 }
22382255 }
2239-
2256+ sessionStorage . setItem ( 'active_loginid' , active_loginid ) ;
22402257 localStorage . setItem ( 'active_loginid' , active_loginid ) ;
22412258 localStorage . setItem ( 'client.accounts' , JSON . stringify ( client_object ) ) ;
22422259 this . syncWithLegacyPlatforms ( active_loginid , this . accounts ) ;
0 commit comments