From ebe4830c2c1c693043bfdf0857bce4cbd3ffb30e Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Fri, 24 Jul 2020 15:56:01 -0500
Subject: [PATCH] Get redir from query string

---
 react/src/components/Main.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/react/src/components/Main.jsx b/react/src/components/Main.jsx
index a1e1456..804da40 100644
--- a/react/src/components/Main.jsx
+++ b/react/src/components/Main.jsx
@@ -13,6 +13,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
 const DEBUG = true;
 // use REMOTE_USER for production
 const username = 'louistw';
+const params = new URLSearchParams(window.location.search);
+const redir_url = params.get('redir') || '/pun/sys/dashboard';
 
 function Main(props) {
   // Setup states
@@ -78,8 +80,8 @@ function Main(props) {
           clearTimeout(myTimer);
       })()
       setTimeout(() => {
-        if (DEBUG) console.log('Redirecting to /test')
-        window.location = '/test';
+        if (DEBUG) console.log('Redirecting to ' + redir_url)
+        window.location = redir_url;
       }, sec * 1000);
     });
 
-- 
GitLab