From 29f599dc9d6d72247841ae441a6cda95b273270c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 22 Jun 2018 00:36:13 +0300 Subject: Simplify Facebook login --- vnext/src/components/LoginButton.js | 2 +- vnext/src/index.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'vnext/src') diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js index 558f61f4..0a861307 100644 --- a/vnext/src/components/LoginButton.js +++ b/vnext/src/components/LoginButton.js @@ -57,7 +57,7 @@ export default class LoginButton extends React.Component { onClose={this.toggleModal}>

Please, introduce yourself:

- Login with facebook + Login with facebook Login with VK

Already registered?

diff --git a/vnext/src/index.js b/vnext/src/index.js index 848a689e..556745ff 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -21,10 +21,15 @@ class App extends React.Component { constructor(props) { super(props); this.auth = this.auth.bind(this); + let params = qs.parse(window.location.search) + if (params.hash) { + window.localStorage.hash = params.hash + window.history.replaceState({}, document.title, `${window.location.protocol}//${window.location.host}${window.location.pathname}`) + } this.state = { visitor: { uid: Number(window.localStorage.uid) || 0, - hash: window.localStorage.hash || '' + hash: window.localStorage.hash || params.hash || '' }, headerClassName: '' }; @@ -138,11 +143,6 @@ class App extends React.Component { } /> - { - let params = qs.parse(props.location.search) - this.auth(params.hash) - return - }} /> } /> } /> } /> @@ -230,6 +230,9 @@ class App extends React.Component { this.setState({ visitor: visitor }) + }).catch(reason => { + window.localStorage.clear() + window.location.reload() }) } } -- cgit v1.2.3