diff --git a/core/src/components/friends-view/profile.js b/core/src/components/friends-view/profile.js index 8d574ab1..cbce23f8 100644 --- a/core/src/components/friends-view/profile.js +++ b/core/src/components/friends-view/profile.js @@ -593,7 +593,7 @@ class ProfileQdn extends connect(store)(LitElement) { this.resourceExists = true; this.profileData = data; store.dispatch(setProfileData(data)); - + parentEpml.request('showSnackBar', get('profile.profile22')) worker.terminate(); } catch (error) { diff --git a/plugins/plugins/core/sponsorship-list/sponsorship-list.src.js b/plugins/plugins/core/sponsorship-list/sponsorship-list.src.js index ebc74070..bf552c27 100644 --- a/plugins/plugins/core/sponsorship-list/sponsorship-list.src.js +++ b/plugins/plugins/core/sponsorship-list/sponsorship-list.src.js @@ -721,23 +721,29 @@ class SponsorshipList extends LitElement { } const getTxnRequestResponse = (txnResponse) => { - if(txnResponse.extraData.rewardSharePrivateKey && (txnResponse.data.message.includes('multiple') || txnResponse.data.message.includes('SELF_SHARE_EXISTS'))) { - this.privateRewardShareKey = txnResponse.extraData.rewardSharePrivateKey - this.confirmRelationship(publicKeyValue, isCopy) - } else if (txnResponse.success === false && txnResponse?.message) { - this.errorMessage = txnResponse?.message - this.isLoadingCreateSponsorship = false - throw(txnResponse?.message) - } else if ( - txnResponse.success === true && - !txnResponse.data.error - ) { - this.privateRewardShareKey = txnResponse.extraData.rewardSharePrivateKey - this.confirmRelationship(publicKeyValue, isCopy) + + const extraData = txnResponse && txnResponse.extraData; + const data = txnResponse && txnResponse.data; + const dataMessage = data && data.message; + const extraDataPrivateKey = extraData && extraData.rewardSharePrivateKey; + const txnSuccess = txnResponse && txnResponse.success; + + if (extraDataPrivateKey && typeof dataMessage === 'string' && + (dataMessage.includes('multiple') || dataMessage.includes('SELF_SHARE_EXISTS'))) { + this.privateRewardShareKey = extraDataPrivateKey; + this.confirmRelationship(publicKeyValue, isCopy); + } else if (txnSuccess === false && txnResponse.message) { + this.errorMessage = txnResponse.message; + this.isLoadingCreateSponsorship = false; + throw new Error(txnResponse.message); + } else if (txnSuccess === true && !(data && data.error)) { + this.privateRewardShareKey = extraDataPrivateKey; + this.confirmRelationship(publicKeyValue, isCopy); } else { - this.errorMessage = txnResponse.data.message || txnResponse.message - this.isLoadingCreateSponsorship = false - throw(txnResponse.data.message || txnResponse.message) + const defaultErrorMessage = 'An unknown error occurred.'; + this.errorMessage = dataMessage || txnResponse.message || defaultErrorMessage; + this.isLoadingCreateSponsorship = false; + throw new Error(dataMessage || txnResponse.message || defaultErrorMessage); } } validateReceiver()