Merge pull request #221 from Philreact/bugfix/sponsorship-list-includes-error
fix sponsorship list includes error
This commit is contained in:
commit
db9c265fb9
@ -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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user