diff --git a/public/assets/my.js b/public/assets/my.js index ea5c3d2..472bfd5 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -1404,7 +1404,21 @@ })); } catch (e) {} } + // came from PolHunter (iap.return cookie): one card at the top of the Overview that sends them back + async function loadReturnCard() { + const card = $('phReturn'); if (!card) return; + try { + const me = await (await fetch('/api/me')).json(); + if (me.returnTo !== 'polhunter') { card.hidden = true; return; } + card.hidden = false; + card.innerHTML = '

You came from PolHunter

' + (me.address + ? '

Your wallet is linked, so your board is ready.

Back to PolHunter' + : '

One step left: link the wallet your POL drips will be paid to. The moment it is linked you go straight back.

'); + const b = $('phGoWallet'); if (b) b.addEventListener('click', () => { const m = document.querySelector('.bo-menu [data-pane="wallet"]'); if (m) m.click(); }); + } catch (e) {} + } async function loadCoach() { + loadReturnCard(); loadTank(); try { const r = await (await fetch('/api/my/coach')).json(); @@ -2383,7 +2397,8 @@ })); $('linkBtn').addEventListener('click', busy($('linkBtn'), async () => { IAP.status('Check your wallet for the free link signature…'); - await IAPWallet.signIn(); // server binds the wallet to the signed-in email account + const lr = await IAPWallet.signIn(); // server binds the wallet to the signed-in email account + if (lr && lr.next) { IAP.status('Wallet linked. Taking you back to PolHunter…', 'ok'); setTimeout(() => { location.href = lr.next; }, 700); return; } // they came from PolHunter: close the loop IAP.status('Wallet linked. Earnings pay there from now on.', 'ok'); await render(); })); diff --git a/public/my.html b/public/my.html index da75ef3..b659c06 100644 --- a/public/my.html +++ b/public/my.html @@ -172,6 +172,7 @@
+