aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r--vnext/src/App.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js
index 14ae7d5e..20ece23e 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -15,6 +15,8 @@ import Avatar from './components/Avatar';
import Header from './components/Header';
import SearchBox from './components/SearchBox';
+import cookies from 'react-cookies';
+
import { me } from './api';
export default class App extends React.Component {
@@ -22,13 +24,13 @@ export default class App extends React.Component {
super(props);
let params = qs.parse(window.location.search);
if (params.hash) {
- localStorage.visitor = JSON.stringify({ uid: 0, hash: params.hash });
+ cookies.save('hash', params.hash, { path: '/' });
window.history.replaceState({}, document.title, `${window.location.protocol}//${window.location.host}${window.location.pathname}`);
}
this.state = {
- visitor: localStorage.visitor ? JSON.parse(localStorage.visitor) : {
+ visitor: {
uid: 0,
- hash: params.hash || ''
+ hash: cookies.load('hash')
}
};
this.pm = React.createRef();
@@ -87,7 +89,7 @@ export default class App extends React.Component {
}
componentDidMount() {
- const { hash, uid } = this.state.visitor;
+ const { hash } = this.state.visitor;
this.initWS();
if (hash) {
me().then(visitor => this.auth(visitor));