mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-03-31 01:35:54 +00:00
add page loader
This commit is contained in:
parent
5b546e629d
commit
aad05a69c3
@ -79,38 +79,47 @@ class BecomeMinter extends LitElement {
|
|||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
getNodeInfo() {
|
async getNodeInfo() {
|
||||||
parentEpml
|
const nodeInfo = await parentEpml.request('apiCall', {
|
||||||
.request('apiCall', { url: `/admin/status` })
|
url: `/admin/status`,
|
||||||
.then((res) => {
|
});
|
||||||
this.nodeInfo = res;
|
|
||||||
this.isPageLoading = false;
|
return nodeInfo;
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
this.isPageLoading = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async firstUpdated() {
|
async firstUpdated() {
|
||||||
console.log({ change: 11 });
|
|
||||||
|
|
||||||
this.changeLanguage();
|
this.changeLanguage();
|
||||||
this.getNodeInfo();
|
|
||||||
this.addressInfo =
|
this.addressInfo =
|
||||||
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
|
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
|
||||||
|
this.isPageLoading = true;
|
||||||
|
try {
|
||||||
|
const [nodeInfo, myRewardShareArray] = await Promise.all([
|
||||||
|
this.getNodeInfo(),
|
||||||
|
await this.getRewardShareRelationship(
|
||||||
|
window.parent.reduxStore.getState().app?.selectedAddress
|
||||||
|
?.address
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
await this.getRewardShareRelationship(
|
this.nodeInfo = nodeInfo;
|
||||||
window.parent.reduxStore.getState().app?.selectedAddress?.address
|
this.rewardSharePublicKey =
|
||||||
);
|
myRewardShareArray[0]?.rewardSharePublicKey;
|
||||||
|
this.isPageLoading = false;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
this.isPageLoading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRewardShareRelationship(recipientAddress) {
|
async getRewardShareRelationship(recipientAddress) {
|
||||||
let myRewardShareArray = await parentEpml.request('apiCall', {
|
const myRewardShareArray = await parentEpml.request('apiCall', {
|
||||||
type: 'api',
|
type: 'api',
|
||||||
url: `/addresses/rewardshares?minters=${recipientAddress}&recipients=${recipientAddress}`,
|
url: `/addresses/rewardshares?minters=${recipientAddress}&recipients=${recipientAddress}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rewardSharePublicKey = myRewardShareArray[0]?.rewardSharePublicKey;
|
return myRewardShareArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
_levelUpBlocks() {
|
_levelUpBlocks() {
|
||||||
@ -129,6 +138,15 @@ class BecomeMinter extends LitElement {
|
|||||||
this.rewardSharePublicKey;
|
this.rewardSharePublicKey;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
${this.isPageLoading
|
||||||
|
? html`
|
||||||
|
<div class="loadingContainer">
|
||||||
|
<div class="loading"></div>
|
||||||
|
</div>
|
||||||
|
<div class="backdrop"></div>
|
||||||
|
`
|
||||||
|
: ''}
|
||||||
|
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<h1 class="header-title">
|
<h1 class="header-title">
|
||||||
${translate('becomeMinterPage.bchange1')}
|
${translate('becomeMinterPage.bchange1')}
|
||||||
@ -137,7 +155,6 @@ class BecomeMinter extends LitElement {
|
|||||||
<hr class="divider" />
|
<hr class="divider" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${this.isPageLoading ? html` <p>Loading....</p> ` : ''}
|
|
||||||
${isAlreadySponsored
|
${isAlreadySponsored
|
||||||
? ''
|
? ''
|
||||||
: html` <not-sponsored></not-sponsored> `}
|
: html` <not-sponsored></not-sponsored> `}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user