aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/components/LoginButton.js2
-rw-r--r--vnext/src/index.js15
2 files changed, 10 insertions, 7 deletions
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index 558f61f43..0a861307c 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}>
<div className="dialoglogin">
<p>Please, introduce yourself:</p>
- <a href={`https://api.juick.com/_fblogin?state=${window.location.protocol}//${window.location.host}/_fblogin`} id="signfb"><Icon name="ei-sc-facebook" size="s" />Login with facebook</a>
+ <a href={`https://api.juick.com/_fblogin?state=${window.location.protocol}//${window.location.host}/${window.location.pathname}`} id="signfb"><Icon name="ei-sc-facebook" size="s" />Login with facebook</a>
<a href="/_vklogin" id="signvk"><Icon name="ei-sc-vk" size="s" />Login with VK</a>
<p>Already registered?</p>
<form onSubmit={this.login.bind(this)}>
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 848a689e3..556745ff5 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()
})
}
}