aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/index.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-20 01:00:22 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:52 +0300
commitadef6007788557b4a5847de67049c14f32975d1b (patch)
treea2ca662cc8246e61d88ded36d182e5d35fea6143 /vnext/src/index.js
parente60138b1e51ea6bf4ec553419bb2fa5c4693feaf (diff)
fix initial load with hash
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r--vnext/src/index.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js
index e2090b78..a5bfa1c5 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -17,7 +17,10 @@ class App extends React.Component {
super(props);
this.auth = this.auth.bind(this);
this.state = {
- visitor: { uid: 0 },
+ visitor: {
+ uid: window.localStorage.uid || 0,
+ hash: window.localStorage.hash || ''
+ },
headerClassName: ''
};
this.dHeight = 0;
@@ -58,7 +61,7 @@ class App extends React.Component {
}
this.wScrollBefore = this.wScrollCurrent;
}));
- this.auth(window.localStorage.hash || '')
+ this.auth(this.state.visitor.hash)
}
throttle(delay, fn) {
var last, deferTimer;
@@ -201,8 +204,9 @@ class App extends React.Component {
return response.json()
})
.then(users => {
- let visitor = users[0]
- visitor.hash = data
+ let visitor = users[0];
+ visitor.hash = data;
+ window.localStorage.uid = visitor.uid;
this.setState({
visitor: visitor
})