aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/index.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-27 16:32:53 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit660cc823d4f2446dbc3113b2de4d3164664303fb (patch)
treead6b807841a926313806892e2410f7932d717837 /vnext/src/index.js
parent930736e7b3ff29de16aaec9229242bd83c09f3b7 (diff)
fix social login
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r--vnext/src/index.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 9527178e..9dbf21e7 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -15,11 +15,14 @@ import Footer from './components/Footer';
import Avatar from './components/Avatar';
import Header from './components/Header';
+import { me } from './api';
+
class App extends React.Component {
constructor(props) {
super(props);
let params = qs.parse(window.location.search)
if (params.hash) {
+ localStorage.visitor = JSON.stringify({uid: 0, hash: params.hash});
window.history.replaceState({}, document.title, `${window.location.protocol}//${window.location.host}${window.location.pathname}`)
}
this.state = {
@@ -30,6 +33,13 @@ class App extends React.Component {
};
}
+ componentDidMount() {
+ const {hash, uid} = this.state.visitor;
+ if (uid === 0 && hash) {
+ me().then(visitor => this.auth(visitor))
+ }
+ }
+
render() {
const user = this.state.visitor;
return (