aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/index.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-22 00:36:13 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit29f599dc9d6d72247841ae441a6cda95b273270c (patch)
tree5edacabf75a083d25afdbdf92ce66f628f2c1b18 /vnext/src/index.js
parent2b02456c23ecec6039278cbdc5362a9551b9a58a (diff)
Simplify Facebook login
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r--vnext/src/index.js15
1 files changed, 9 insertions, 6 deletions
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 {
<Route exact path="/settings" render={(props) =>
<Settings visitor={user} {...props} />
} />
- <Route exact path="/_fblogin" render={(props) => {
- let params = qs.parse(props.location.search)
- this.auth(params.hash)
- return <Redirect to="/" />
- }} />
<Route exact path="/post" render={(props) => <Post visitor={user} {...props} />} />
<Route exact path="/pm" render={(props) => <Contacts visitor={user} {...props} />} />
<Route exact path="/pm/:user" render={(props) => <Chat visitor={user} {...props} />} />
@@ -230,6 +230,9 @@ class App extends React.Component {
this.setState({
visitor: visitor
})
+ }).catch(reason => {
+ window.localStorage.clear()
+ window.location.reload()
})
}
}