From daee96ce3f913bd675d507e54938fa6d9bf9b62b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 3 Aug 2020 03:26:20 +0000 Subject: [PATCH] Send user details to ping auth route --- webclient/src/App.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/webclient/src/App.js b/webclient/src/App.js index 1c1b65f..d1d036a 100644 --- a/webclient/src/App.js +++ b/webclient/src/App.js @@ -64,15 +64,22 @@ function App() { } useEffect(() => { - user && requester('/ping/', 'POST', token, {}) - .then() - .catch(err => { - console.log(err); - if (err.data && err.data.detail === 'Invalid token.') { - logout(); // You Sure? - logout(); - } - }); + if (user) { + const data = { + id: user.member.id, + username: user.username, + path: history.location.pathname, + }; + requester('/ping/', 'POST', token, data) + .then() + .catch(err => { + console.log(err); + if (err.data && err.data.detail === 'Invalid token.') { + logout(); // You Sure? + logout(); + } + }); + } }, [history.location]); useEffect(() => {