From 2974055bbad6b16d2f7936c141d24966ad2ae287 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 14 Aug 2019 11:34:01 +0300 Subject: Do not render anonymous page before auth --- vnext/src/App.js | 96 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 41 deletions(-) (limited to 'vnext/src') diff --git a/vnext/src/App.js b/vnext/src/App.js index 7738abcd..41c8849b 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -32,9 +32,14 @@ export default function App() { let retpath = params.retpath || `${window.location.protocol}//${window.location.host}${window.location.pathname}`; window.history.replaceState({}, document.title, retpath); } - const [visitor, setVisitor] = useState({ - uid: 0 - }); + + /** + * @type {import('./api').SecureUser} + */ + const anonymous = { + uid: -1 + }; + const [visitor, setVisitor] = useState(anonymous); let updateStatus = () => { // refresh server visitor state (unread counters) @@ -102,47 +107,56 @@ export default function App() {
-- cgit v1.2.3