keep-network / tbtc-dapp

Deposit BTC and redeem TBTC
http://dapp.test.tbtc.network/
MIT License
33 stars 31 forks source link

Reset state when restarting flows #354

Closed ironng closed 3 years ago

ironng commented 3 years ago

Adds a new action to reset state when starting a deposit or redemption flow. The action is triggered in a useEffect so it should run on page load or when hitting the back button.

Also clears any errors from the state when the HISTORY_PUSH action occurs. Note this action only happens when the history is modified programmatically via navigateTo and not when the user hits the back button in the browser. We also try to clear errors when logical. For instance, the requestDepositError will be reset in the state when a new deposit request is sent.

Lastly, there is a little refactoring here to rewrite the Start component as a functional component.