2
const responseFacebook = (response) => {
console.log(response);
const payload = {
id: response.id,
name: response.name,
email: response.email,
token: response.accessToken
}
return payload
}
class FacebookLogin extends Component {
co
login = (auth) => {
console.log("************Entering***************** ")
this.props.userLogin(auth, this.props.location.state ? this.props.location.state.nextPathname : '/')
};
render() {
const { handleSubmit, submitting, theme } = this.props;
const muiTheme = getMuiTheme(theme);
const { primary1Color, accent1Color } = getColorsFromTheme(muiTheme);
return (
<MuiThemeProvider muiTheme={muiTheme}>
<div style={{ ...styles.main, backgroundColor: primary1Color }}>
<Card style={styles.card}>
<div style={styles.avatar}>
<Avatar backgroundColor={accent1Color} icon={<LockIcon />} size={60} />
</div>
<form onSubmit={handleSubmit(this.login)}>
<CardActions>
<FacebookLogin
appId="1023727501002149"
autoLoad={true}
fields="name,email,picture"
callback={responseFacebook}
cssClass="my-facebook-button-class"
icon="fa-facebook"
/>
</CardActions>
</form>
</Card>
<Notification />
</div>
</MuiThemeProvider>
);
}
}
FacebookLogin.propTypes = {
...propTypes,
authClient: PropTypes.func,
previousRoute: PropTypes.string,
theme: PropTypes.object,
userLogin: PropTypes.func.isRequired,
};
FacebookLogin.defaultProps = {
theme: defaultTheme,
};
const enhance = compose(
reduxForm({
form: 'signIn',
validate: (values, props) => {
const errors = {};
return errors;
},
}),
connect(null, { userLogin: userLoginAction }),
);
export default enhance(FacebookLogin);
https://www.npmjs.com/package/react-facebook-loginを使用して、残りの管理者にFacebookのログインを実装しようとしています。安心して管理者にFacebookのログインを構築するには?
このログインコンポーネントは、facebookLoginクラスで定義されたログイン機能に送信する必要がある、Facebookからの応答を取得しています。
本当に事前に
おかげでいただければ幸いコンポーネントに
ヘルプを使用して反応し、私は残りのadminでカスタムFacebookのログインページを作成することができますどのようにアドバイスをしてください! :)
こんにちは。おそらく、コンポーネントをより適切な名前に変更する必要があります。 –