mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Fixes button not showing and re-login
This commit is contained in:
parent
38136ade4d
commit
47f92569ef
@ -68,13 +68,13 @@ export default {
|
|||||||
logout() {
|
logout() {
|
||||||
return {
|
return {
|
||||||
type: 'LOGOUT',
|
type: 'LOGOUT',
|
||||||
payload: API.call({
|
payload: Promise.resolve()
|
||||||
path: '/user/logout',
|
.then(() => gapi.auth2.getAuthInstance().signOut())
|
||||||
data: {}
|
.then(() => API.call({
|
||||||
}).then(() => {
|
path: '/user/logout',
|
||||||
gapi.auth2.getAuthInstance().signOut();
|
data: {}
|
||||||
})
|
}))
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getUserData(userId, token, staff) {
|
getUserData(userId, token, staff) {
|
||||||
|
@ -35,6 +35,10 @@ class MainHomePageLoginWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.renderGoogleButton();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<WidgetTransition sideToShow={this.state.sideToShow} className={classNames('login-widget__container', this.props.className)}>
|
<WidgetTransition sideToShow={this.state.sideToShow} className={classNames('login-widget__container', this.props.className)}>
|
||||||
@ -45,7 +49,6 @@ class MainHomePageLoginWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderLogin() {
|
renderLogin() {
|
||||||
this.renderGoogleButton();
|
|
||||||
return (
|
return (
|
||||||
<Widget className="main-home-page__widget" title={i18n('LOG_IN')} ref="loginWidget">
|
<Widget className="main-home-page__widget" title={i18n('LOG_IN')} ref="loginWidget">
|
||||||
<Form {...this.getLoginFormProps()}>
|
<Form {...this.getLoginFormProps()}>
|
||||||
@ -67,10 +70,6 @@ class MainHomePageLoginWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderGoogleButton() {
|
renderGoogleButton() {
|
||||||
const defaultGoogleHandler = (response) => {
|
|
||||||
console.log(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
gapi.load('auth2', () => {
|
gapi.load('auth2', () => {
|
||||||
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
||||||
gapi.signin2.render('google-oauth-id', {
|
gapi.signin2.render('google-oauth-id', {
|
||||||
@ -80,7 +79,9 @@ class MainHomePageLoginWidget extends React.Component {
|
|||||||
longtitle: true,
|
longtitle: true,
|
||||||
theme: 'dark',
|
theme: 'dark',
|
||||||
onsuccess: this.onGoogleLoginSuccess.bind(this),
|
onsuccess: this.onGoogleLoginSuccess.bind(this),
|
||||||
onfailure: defaultGoogleHandler
|
onfailure: (response) => {
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user