update random user_id gen
This commit is contained in:
@ -38,6 +38,7 @@ const TheContent = () => {
|
||||
|
||||
useEffect(() => {
|
||||
fetchSession()
|
||||
get_token_from_storage_or_cookie();
|
||||
}, []);
|
||||
|
||||
async function postUserData(data) {
|
||||
@ -108,7 +109,6 @@ const TheContent = () => {
|
||||
|
||||
function get_token_from_storage_or_cookie() {
|
||||
//return true;
|
||||
var user_id = null;
|
||||
const cookies = new Cookies();
|
||||
const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66627373736f2e74732e62697a736964652e62697a2f73686962626f6c657468')
|
||||
if (shib !== undefined) {
|
||||
@ -118,8 +118,7 @@ const TheContent = () => {
|
||||
fetchUser().then(() => {
|
||||
if(UserId === ''){
|
||||
let id = Math.floor(100000 + Math.random() * 900000)
|
||||
user_id = id;
|
||||
//setUserId(id);
|
||||
setUserId(id);
|
||||
}
|
||||
const _firstname = UserData.firstname;
|
||||
const _lastname = UserData.lastname;
|
||||
@ -147,7 +146,6 @@ const TheContent = () => {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
setUserId(user_id);
|
||||
});
|
||||
} else {
|
||||
return null;
|
||||
@ -156,47 +154,33 @@ const TheContent = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<main className = "c-main">
|
||||
<CContainer fluid >
|
||||
<Suspense fallback = { loading }>
|
||||
<Switch > {
|
||||
routes.map((route, idx) => {
|
||||
<main className="c-main">
|
||||
<CContainer fluid>
|
||||
<Suspense fallback={loading}>
|
||||
<Switch>
|
||||
{routes.map((route, idx) => {
|
||||
return route.component && (
|
||||
<Route key = { idx }
|
||||
path = { route.path }
|
||||
exact = { route.exact }
|
||||
name = { route.name }
|
||||
|
||||
|
||||
|
||||
// render = {
|
||||
// props =>
|
||||
// ( <route.component {...props} userid={1} email={"akira.miyata@mobilous.com"}/>
|
||||
// )
|
||||
// }
|
||||
|
||||
|
||||
|
||||
render = {
|
||||
props =>
|
||||
get_token_from_storage_or_cookie() !== null ?
|
||||
( <route.component {...props} userid={UserId} email={UserData.email}/>
|
||||
) : ( <Redirect to = {
|
||||
{ pathname: "/sso" }
|
||||
}
|
||||
/>
|
||||
)
|
||||
<Route
|
||||
key={idx}
|
||||
path={route.path}
|
||||
exact={route.exact}
|
||||
name={route.name}
|
||||
render={(props) =>
|
||||
get_token_from_storage_or_cookie() !== null ? (
|
||||
<route.component {...props} userid={UserId} email={UserData.email} />
|
||||
) : (
|
||||
<Redirect to={{ pathname: "/sso" }} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
)
|
||||
})
|
||||
}
|
||||
<Redirect
|
||||
from = "/"
|
||||
to = "/dashboard" / >
|
||||
</Switch> </Suspense >
|
||||
</CContainer> </main >
|
||||
)
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<Redirect from="/" to="/dashboard" />
|
||||
</Switch>
|
||||
</Suspense>
|
||||
</CContainer>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(TheContent)
|
||||
|
||||
Reference in New Issue
Block a user