From bfe00ae040f35f12ae8cc87827c0f9bf06567c0a Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 17 May 2020 00:40:48 +0000 Subject: [PATCH] Add refresh stats easter egg --- webclient/src/Home.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webclient/src/Home.js b/webclient/src/Home.js index 98bcce7..1c580e0 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useReducer } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import moment from 'moment-timezone'; import './light.css'; @@ -130,6 +130,7 @@ function MemberInfo(props) { export function Home(props) { const { user } = props; const [stats, setStats] = useState(JSON.parse(localStorage.getItem('stats', 'false'))); + const [refreshCount, refreshStats] = useReducer(x => x + 1, 0); useEffect(() => { requester('/stats/', 'GET') @@ -141,7 +142,7 @@ export function Home(props) { console.log(err); setStats(false); }); - }, []); + }, [refreshCount]); const getStat = (x) => stats && stats[x] ? stats[x] : '?'; const getDateStat = (x) => stats && stats[x] ? moment.utc(stats[x]).tz('America/Edmonton').format('ll') : '?'; @@ -186,7 +187,7 @@ export function Home(props) {

Admin Google Group

{!!user &&

Google Drive

} - + refreshStats()} />
Protospace Stats