mirror of https://github.com/status-im/fathom.git
use singular if visitor count == 1. closes #34
This commit is contained in:
parent
4806de98fe
commit
72c2952e15
|
@ -23,12 +23,19 @@ class Realtime extends Component {
|
|||
clearInterval(this.interval);
|
||||
}
|
||||
|
||||
@bind
|
||||
setDocumentTitle() {
|
||||
// update document title
|
||||
let visitorText = this.state.count == 1 ? 'visitor' : 'visitors';
|
||||
document.title = ( this.state.count > 0 ? `${this.state.count} current ${visitorText} — Fathom` : 'Fathom' );
|
||||
}
|
||||
|
||||
@bind
|
||||
fetchData() {
|
||||
Client.request(`stats/site/realtime`)
|
||||
.then((d) => {
|
||||
this.setState({ count: d })
|
||||
document.title = ( d > 0 ? d + ' current visitors — Fathom' : 'Fathom' );
|
||||
this.setDocumentTitle();
|
||||
})
|
||||
.catch((e) => {
|
||||
if(e.message == 401) {
|
||||
|
|
Loading…
Reference in New Issue