Skip to content

Commit

Permalink
Merge pull request #650 from auth0/overlay-signuplink-spa
Browse files Browse the repository at this point in the history
Fix Issues with Overlay mode + signUpLink setting on a SPA
  • Loading branch information
hzalaz authored Oct 19, 2016
2 parents 9ed2fcb + 7c86efe commit b2cbad8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/connection/database/login_sign_up_tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { showLoginActivity, showSignUpActivity } from './actions';
import * as l from '../../core/index';
import { getScreen } from './index';
import { closeLock } from '../../core/actions';

export default class LoginSignUpTabs extends React.Component {

Expand All @@ -26,6 +27,7 @@ export default class LoginSignUpTabs extends React.Component {
label={signUpLabel}
current={!isLogin}
clickHandler={::this.handleSignUpClick}
clickWithHrefHandler={::this.handleSignUpWithHrefClick}
href={signUpLink}
/>
</ul>
Expand All @@ -38,9 +40,16 @@ export default class LoginSignUpTabs extends React.Component {
}

handleSignUpClick() {
if (this.props.signUpLink) {
closeLock(l.id(this.props.lock), true);
}
showSignUpActivity(l.id(this.props.lock));
}

handleSignUpWithHrefClick() {
closeLock(l.id(this.props.lock), true);
}

}

LoginSignUpTabs.propTypes = {
Expand All @@ -53,8 +62,12 @@ LoginSignUpTabs.propTypes = {
class LoginSignUpTab extends React.Component {

handleClick(e) {
e.preventDefault();
this.props.clickHandler();
if (this.props.href) {
this.props.clickWithHrefHandler();
} else {
e.preventDefault();
this.props.clickHandler();
}
}

render() {
Expand All @@ -65,7 +78,7 @@ class LoginSignUpTab extends React.Component {
<li className={className}>
<a
href={href || "#"}
onClick={href ? undefined : ::this.handleClick}
onClick={::this.handleClick}
>
{label}
</a>
Expand Down

0 comments on commit b2cbad8

Please sign in to comment.