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) => { onRemoveToken = (token: Token) => {
const { safeAddress, removeToken } = this.props const { safeAddress, removeToken } = this.props
@ -57,6 +61,7 @@ class TokenLayout extends React.PureComponent<TokenProps, State> {
token={token} token={token}
safeAddress={safeAddress} safeAddress={safeAddress}
removeTokenAction={removeToken} removeTokenAction={removeToken}
onReset={this.onReset}
/>, />,
}) })
} }

View File

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