WA-232 Fix onReset behaviour

This commit is contained in:
apanizo 2018-07-26 13:40:19 +02:00
parent dc0b526533
commit 52443c5307
2 changed files with 10 additions and 5 deletions

View File

@ -49,6 +49,10 @@ class TokenLayout extends React.PureComponent<TokenProps, State> {
})
}
onReset = () => {
this.setState({ component: undefined })
}
onRemoveToken = (token: Token) => {
const { safeAddress, removeToken } = this.props
@ -57,6 +61,7 @@ class TokenLayout extends React.PureComponent<TokenProps, State> {
token={token}
safeAddress={safeAddress}
removeTokenAction={removeToken}
onReset={this.onReset}
/>,
})
}

View File

@ -13,6 +13,7 @@ type Props = {
token: Token,
safeAddress: string,
removeTokenAction: typeof RemoveTokenAction,
onReset: () => void,
}
type State = {
@ -21,17 +22,16 @@ type State = {
export const REMOVE_TOKEN_RESET_BUTTON_TEXT = 'RESET'
export const removeToken = (safeAddress: string, token: Token, removeTokenAction: typeof RemoveTokenAction) => {
export const removeToken = async (safeAddress: string, token: Token, removeTokenAction: typeof RemoveTokenAction) =>
removeTokenAction(safeAddress, token)
}
class RemoveToken extends React.PureComponent<Props, State> {
state = {
done: false,
}
onReset = () => {
this.setState({ done: false })
onRemoveReset = () => {
this.setState({ done: false }, this.props.onReset())
}
executeRemoveOperation = async () => {
@ -59,7 +59,7 @@ class RemoveToken extends React.PureComponent<Props, State> {
finishedButton={finishedButton}
onSubmit={this.executeRemoveOperation}
steps={steps}
onReset={this.onReset}
onReset={this.onRemoveReset}
>
<Stepper.Page name={token.get('name')} symbol={token.get('symbol')} funds={token.get('funds')}>
{ Review }