mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-16 16:15:54 +00:00
fix sponsorship list includes error
This commit is contained in:
parent
1d4d797bd8
commit
f588ffe5d3
@ -721,23 +721,30 @@ 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)
|
||||
// It's a good practice to provide a default error message
|
||||
const defaultErrorMessage = 'An unknown error occurred.';
|
||||
this.errorMessage = dataMessage || txnResponse.message || defaultErrorMessage;
|
||||
this.isLoadingCreateSponsorship = false;
|
||||
throw new Error(dataMessage || txnResponse.message || defaultErrorMessage);
|
||||
}
|
||||
}
|
||||
validateReceiver()
|
||||
|
Loading…
x
Reference in New Issue
Block a user