Skip to content

Commit

Permalink
fix(product-picker): change back to functional component
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed May 11, 2022
1 parent b3cb7a0 commit cfe5724
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default ({ api, coreSagas, networks }) => {
})
break
// web - exchange sso login with redirect from deeplink
// TODO: this is just for FF off testing ons taging
// TODO: this is just for FF off testing on staging
// TODO: change this to work for real, where we use
// redirect from exchange deeplink into login
case redirect !== undefined && redirect.includes('beta') && platform === PlatformTypes.WEB:
window.open(`${redirect}?jwt=${jwtToken}`, '_self', 'noreferrer')
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,39 @@ import ProductPicker from './template'
import Error from './template.error'
import ExchangeUserConflict from './template.error.exchange'

class ProductPickerContainer extends PureComponent<Props> {
walletRedirect = () => {
this.props.signupActions.setRegisterEmail(undefined)
this.props.routerActions.push('/home')
const ProductPickerContainer: React.FC<Props> = (props) => {
const walletRedirect = () => {
props.signupActions.setRegisterEmail(undefined)
props.routerActions.push('/home')
// for first time login users we need to run goal since this is a first page we show them
this.props.saveGoal('welcomeModal', { firstLogin: true })
this.props.runGoals()
props.saveGoal('welcomeModal', { firstLogin: true })
props.runGoals()
}

exchangeRedirect = () => {
this.props.signupActions.setRegisterEmail(undefined)
this.props.profileActions.authAndRouteToExchangeAction(ExchangeAuthOriginType.Signup)
const exchangeRedirect = () => {
props.signupActions.setRegisterEmail(undefined)
props.profileActions.authAndRouteToExchangeAction(ExchangeAuthOriginType.Signup)
}

render() {
return this.props.walletLoginData.cata({
Failure: (error) => <Error error={error} />,
Loading: () => <SpinningLoader />,
NotAsked: () => {
this.props.routerActions.push('/login?product=exchange')
return null
},
Success: () =>
this.props.exchangeUserConflict ? (
<ExchangeUserConflict {...this.props} walletRedirect={this.walletRedirect} />
) : (
<ProductPicker
{...this.props}
walletRedirect={this.walletRedirect}
exchangeRedirect={this.exchangeRedirect}
/>
)
})
}
return props.walletLoginData.cata({
Failure: (error) => <Error error={error} />,
Loading: () => <SpinningLoader />,
NotAsked: () => {
props.routerActions.push('/login?product=exchange')
return null
},
Success: () =>
props.exchangeUserConflict ? (
<ExchangeUserConflict {...props} walletRedirect={walletRedirect} />
) : (
<ProductPicker
{...props}
walletRedirect={walletRedirect}
exchangeRedirect={exchangeRedirect}
/>
)
})
}

const mapStateToProps = (state) => ({
appEnv: selectors.core.walletOptions.getAppEnv(state).getOrElse('prod'),
email: selectors.signup.getRegisterEmail(state) as string,
Expand Down

0 comments on commit cfe5724

Please sign in to comment.