diff --git a/webclient/src/Home.js b/webclient/src/Home.js
index 0d25fcf..8b6f54b 100644
--- a/webclient/src/Home.js
+++ b/webclient/src/Home.js
@@ -128,7 +128,7 @@ function MemberInfo(props) {
};
export function Home(props) {
- const { user } = props;
+ const { user, token } = props;
const [stats, setStats] = useState(JSON.parse(localStorage.getItem('stats', 'false')));
const [refreshCount, refreshStats] = useReducer(x => x + 1, 0);
const location = useLocation();
@@ -136,7 +136,7 @@ export function Home(props) {
const bypass_code = location.hash.replace('#', '');
useEffect(() => {
- requester('/stats/', 'GET')
+ requester('/stats/', 'GET', token)
.then(res => {
setStats(res);
localStorage.setItem('stats', JSON.stringify(res));
@@ -159,6 +159,8 @@ export function Home(props) {
const getTrackAgo = (x) => stats && stats.track && stats.track[x] ? moment.unix(stats.track[x]['time']).tz('America/Edmonton').fromNow() : '';
const getTrackName = (x) => stats && stats.track && stats.track[x] && stats.track[x]['username'] ? stats.track[x]['username'] : 'Unknown';
+ const alarmStat = () => stats && stats.alarm && moment().unix() - stats.alarm['time'] < 300 ? stats.alarm['data'] > 200 ? 'Armed' : 'Disarmed' : 'Unknown';
+
return (
Alarm status: {alarmStat()}
}