+ createAccountSuccess = () => {
+ this.setState({account: {}})
+ this.saveAccountToSessionStorage(null, true)
+ }
+ handleCancelAccount = () => {
+ this.setState({account: {}, currentAccount: null, savedData: null, accountType: null, types: []})
+ this.saveAccountToSessionStorage(null, true)
+ }
+ saveAccountToSessionStorage = (account, clear) => {
+ const userProfile = this.userProfile;
+ if(userProfile) {
+ if(clear) {
+
+ window.sessionStorage.removeItem(userProfile.userId + '@' + userProfile.domain + ':account');
+ // this.setState({
+ // account:null,
+ // accountType: null
+ // })
+ } else {
+ const state = account || this.account;
+ window.sessionStorage.setItem(userProfile.userId + '@' + userProfile.domain + ':account', JSON.stringify(state));
+ }
+ }
+
+ }
+ getTransientAccountForUser = (userProfile) => {
+ let userProfileTransientAccount = window.sessionStorage.getItem(userProfile.userId + '@' + userProfile.domain + ':account') || null;
+ var transientAccount = null;
+ if (userProfileTransientAccount) {
+ transientAccount = JSON.parse(userProfileTransientAccount);
+ };
+ this.saveAccountToSessionStorage(null, true);
+ if(!this.userProfile) {
+ this.setState({
+ savedData: transientAccount,
+ userProfile: userProfile
+ })
+ }
+ }