mirror of
https://github.com/opensupports/opensupports.git
synced 2025-08-19 16:58:39 +02:00
Moves renderGoogleButton out of render
This commit is contained in:
parent
da534e3018
commit
38136ade4d
@ -45,23 +45,7 @@ class MainHomePageLoginWidget extends React.Component {
|
||||
}
|
||||
|
||||
renderLogin() {
|
||||
const defaultGoogleHandler = (response) => {
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
gapi.load('auth2', () => {
|
||||
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
||||
gapi.signin2.render('google-oauth-id', {
|
||||
scope: 'email',
|
||||
width: 200,
|
||||
height: 30,
|
||||
longtitle: true,
|
||||
theme: 'dark',
|
||||
onsuccess: this.onGoogleLoginSuccess.bind(this),
|
||||
onfailure: defaultGoogleHandler
|
||||
})
|
||||
})
|
||||
|
||||
this.renderGoogleButton();
|
||||
return (
|
||||
<Widget className="main-home-page__widget" title={i18n('LOG_IN')} ref="loginWidget">
|
||||
<Form {...this.getLoginFormProps()}>
|
||||
@ -82,6 +66,25 @@ class MainHomePageLoginWidget extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
renderGoogleButton() {
|
||||
const defaultGoogleHandler = (response) => {
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
gapi.load('auth2', () => {
|
||||
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
||||
gapi.signin2.render('google-oauth-id', {
|
||||
scope: 'email',
|
||||
width: 200,
|
||||
height: 30,
|
||||
longtitle: true,
|
||||
theme: 'dark',
|
||||
onsuccess: this.onGoogleLoginSuccess.bind(this),
|
||||
onfailure: defaultGoogleHandler
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
renderPasswordRecovery() {
|
||||
return (
|
||||
<PasswordRecovery ref="passwordRecovery" recoverSent={this.state.recoverSent} formProps={this.getRecoverFormProps()} onBackToLoginClick={this.onBackToLoginClick.bind(this)}/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user