()
| 11 | import Text from "../components/Text"; |
| 12 | |
| 13 | function ProjectRedirect() { |
| 14 | const params = useParams(); |
| 15 | const navigate = useNavigate(); |
| 16 | const dispatch = useDispatch(); |
| 17 | |
| 18 | const initRef = useRef(false); |
| 19 | |
| 20 | useEffect(() => { |
| 21 | if (params.projectId && !initRef.current) { |
| 22 | dispatch(getProject({ project_id: params.projectId, active: true })) |
| 23 | .then((project) => { |
| 24 | if (project?.payload) { |
| 25 | navigate(`/${project.payload.team_id}/${project.payload.id}/dashboard`); |
| 26 | } else { |
| 27 | navigate("/"); |
| 28 | } |
| 29 | }) |
| 30 | .catch(() => { |
| 31 | navigate("/"); |
| 32 | }); |
| 33 | initRef.current = true; |
| 34 | } |
| 35 | }, [params]); |
| 36 | |
| 37 | return ( |
| 38 | <Container> |
| 39 | <div className="h-4" /> |
| 40 | <Row align="center" justify="center"> |
| 41 | <ProgressCircle color="default" size="xl" aria-label="Loading" /> |
| 42 | </Row> |
| 43 | <div className="h-1" /> |
| 44 | <Row align="center" justify="center"> |
| 45 | <Text size="lg" color="gray">Loading the dashboard...</Text> |
| 46 | </Row> |
| 47 | </Container> |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | export default ProjectRedirect; |
nothing calls this directly
no test coverage detected