update for sso

This commit is contained in:
2021-07-28 17:28:25 +05:30
parent 8aad24600a
commit f1f4d10368
55 changed files with 211 additions and 86 deletions

View File

@ -1,4 +1,5 @@
import React, { Suspense } from 'react'
import Cookies from 'js-cookie';
import {
Redirect,
Route,
@ -8,7 +9,7 @@ import { CContainer, CFade } from '@coreui/react'
// routes config
import routes from '../routes'
const loading = (
<div className="pt-3 text-center">
<div className="sk-spinner sk-spinner-pulse"></div>
@ -16,6 +17,13 @@ const loading = (
)
const TheContent = () => {
function get_token_from_storage_or_cookie() {
const shib = Cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468')
console.log(shib);
return null;
}
return (
<main className="c-main">
<CContainer fluid>
@ -28,11 +36,23 @@ const TheContent = () => {
path={route.path}
exact={route.exact}
name={route.name}
render={props => (
<CFade>
render={props =>
get_token_from_storage_or_cookie("tokenName") !== null
? (
<route.component {...props} />
</CFade>
)} />
) : (
<Redirect to={{ pathname: "/sso" }} />
)
}
// render={props => (
// <CFade>
// <route.component {...props} />
// </CFade>
// )}
/>
)
})}
<Redirect from="/" to="/dashboard" />