aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
})