aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vnext/src/index.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 1eb01eae..fda85fed 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -58,6 +58,12 @@ class App extends React.Component {
try {
var jsonMsg = JSON.parse(msg.data);
console.log('data: ' + msg.data);
+ // refresh server visitor state (unread counters)
+ me().then(visitor => {
+ this.setState({
+ visitor: visitor
+ })
+ });
if (jsonMsg.service) {
return;
}
@@ -84,7 +90,7 @@ class App extends React.Component {
componentDidMount() {
const { hash, uid } = this.state.visitor;
this.initWS();
- if (uid === 0 && hash) {
+ if (hash) {
me().then(visitor => this.auth(visitor))
}
}
@@ -111,7 +117,15 @@ class App extends React.Component {
<nav id="global">
<ul>
{user.uid > 0 ?
- <li><Link to={{ pathname: '/discussions' }}><Icon name="ei-comment" size="s" />Discuss</Link></li>
+ <li>
+ <Link to={{ pathname: '/discussions' }}>
+ <Icon name="ei-comment" size="s" /><span>Discuss</span>
+ {
+ user.unreadCount &&
+ <span className="badge">{user.unreadCount}</span>
+ }
+ </Link>
+ </li>
:
<li><Link to='/?media=1' rel="nofollow"><Icon name="ei-camera" size="s" />Photos</Link></li>
}