Merge pull request #221 from Philreact/bugfix/sponsorship-list-includes-error

fix sponsorship list includes error
This commit is contained in:
AlphaX-Projects 2023-11-08 17:01:14 +01:00 committed by GitHub
commit db9c265fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -721,23 +721,29 @@ class SponsorshipList extends LitElement {
} }
const getTxnRequestResponse = (txnResponse) => { const getTxnRequestResponse = (txnResponse) => {
if(txnResponse.extraData.rewardSharePrivateKey && (txnResponse.data.message.includes('multiple') || txnResponse.data.message.includes('SELF_SHARE_EXISTS'))) {
this.privateRewardShareKey = txnResponse.extraData.rewardSharePrivateKey const extraData = txnResponse && txnResponse.extraData;
this.confirmRelationship(publicKeyValue, isCopy) const data = txnResponse && txnResponse.data;
} else if (txnResponse.success === false && txnResponse?.message) { const dataMessage = data && data.message;
this.errorMessage = txnResponse?.message const extraDataPrivateKey = extraData && extraData.rewardSharePrivateKey;
this.isLoadingCreateSponsorship = false const txnSuccess = txnResponse && txnResponse.success;
throw(txnResponse?.message)
} else if ( if (extraDataPrivateKey && typeof dataMessage === 'string' &&
txnResponse.success === true && (dataMessage.includes('multiple') || dataMessage.includes('SELF_SHARE_EXISTS'))) {
!txnResponse.data.error this.privateRewardShareKey = extraDataPrivateKey;
) { this.confirmRelationship(publicKeyValue, isCopy);
this.privateRewardShareKey = txnResponse.extraData.rewardSharePrivateKey } else if (txnSuccess === false && txnResponse.message) {
this.confirmRelationship(publicKeyValue, isCopy) 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 { } else {
this.errorMessage = txnResponse.data.message || txnResponse.message const defaultErrorMessage = 'An unknown error occurred.';
this.isLoadingCreateSponsorship = false this.errorMessage = dataMessage || txnResponse.message || defaultErrorMessage;
throw(txnResponse.data.message || txnResponse.message) this.isLoadingCreateSponsorship = false;
throw new Error(dataMessage || txnResponse.message || defaultErrorMessage);
} }
} }
validateReceiver() validateReceiver()