forgeplus-react/src/forge/Home.jsx

26 lines
834 B
JavaScript

import React , { useEffect } from 'react';
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import ProjectIndex from './Main/Index';
import PersonIndex from './users/Infos';
import { Spin } from 'antd';
export default (CNotificationHOC()(SnackbarHOC()(
TPMIndexHOC((props)=>{
const { pathname } = props.history.location;
const { current_user } = props;
useEffect(()=>{
if(pathname === "/" && (current_user && current_user.login)){
props.history.push(`/users/${current_user && current_user.login}`)
}
})
return(
pathname === "/" && (current_user && current_user.login) ?
<Spin spinning={true}/>
:
<ProjectIndex {...props} />
)
})
)))