diff options
author | Vitaly Takmazov | 2018-06-20 01:00:22 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | adef6007788557b4a5847de67049c14f32975d1b (patch) | |
tree | a2ca662cc8246e61d88ded36d182e5d35fea6143 | |
parent | e60138b1e51ea6bf4ec553419bb2fa5c4693feaf (diff) |
fix initial load with hash
-rw-r--r-- | vnext/src/index.js | 12 |
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 }) |