Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit a482ec8

Browse files
committed
fix: clean url params on goBack
1 parent c4f1717 commit a482ec8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/js/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ switch (`${process.env.nearNetworkId}-${process.env.ethNetworkId}`) {
3030
default: window.bridgeName = 'Unknown'
3131
}
3232

33+
window.addEventListener('load', function cleanUrlParams () {
34+
// When signing a Near tx, if user clicks goBack, then the dapp will think
35+
// it is waiting for the redirect to Near wallet, so clear url params so the
36+
// transfer can be marked FAILED and retried.
37+
const params = Object.keys(window.urlParams.get())
38+
if (
39+
(params.includes('withdrawing') || params.includes('minting')) &&
40+
!(params.includes('transactionHashes') || params.includes('errorCode'))
41+
) {
42+
window.urlParams.clear()
43+
}
44+
})
45+
3346
render()
3447

3548
transfers.onChange(render)

0 commit comments

Comments
 (0)