Skip to content

Instantly share code, notes, and snippets.

@radzserg
Created July 16, 2019 08:25
Show Gist options
  • Select an option

  • Save radzserg/46426064a103f75caafa695a3b23152c to your computer and use it in GitHub Desktop.

Select an option

Save radzserg/46426064a103f75caafa695a3b23152c to your computer and use it in GitHub Desktop.
interface IProps {
socialAuth: ISocialAuth;
}
export default class SocialLoginForm extends Component<IProps> {
loginWithSocialAccount = (e: React.SyntheticEvent) => {
const dataProvider = e.target.dataset.provider
const { socialAuth } = this.props;
socialAuth.login(dataProvider);
};
render() {
const { price } = this.state;
return (
<div>
<button
data-provider="facebook"
onClick={this.loginWithSocialAccount}
>
Facebook
</button>
<button
data-provider="twitter"
onClick={this.loginWithSocialAccount}
>
Twitter
</button>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment