From 5fe5b97e9479e939b0752f5a991ca83b2e1c9363 Mon Sep 17 00:00:00 2001 From: Danny Date: Tue, 8 May 2018 13:20:09 +0200 Subject: [PATCH] use realtime poll to catch expired/invalid login sessions --- assets/js/components/Realtime.js | 5 +++++ assets/js/pages/dashboard.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/js/components/Realtime.js b/assets/js/components/Realtime.js index 188ace4..64364fc 100644 --- a/assets/js/components/Realtime.js +++ b/assets/js/components/Realtime.js @@ -27,6 +27,11 @@ class Realtime extends Component { fetchData() { Client.request(`stats/site/realtime`) .then((d) => { this.setState({ count: d })}) + .catch((e) => { + if(e.message === "Unauthorized") { + this.props.onError(); + } + }) } render(props, state) { diff --git a/assets/js/pages/dashboard.js b/assets/js/pages/dashboard.js index 49410d6..492c704 100644 --- a/assets/js/pages/dashboard.js +++ b/assets/js/pages/dashboard.js @@ -34,7 +34,7 @@ class Dashboard extends Component {