MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / ProjectRedirect

Function ProjectRedirect

client/src/containers/ProjectRedirect.jsx:13–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11import Text from "../components/Text";
12
13function 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
51export default ProjectRedirect;

Callers

nothing calls this directly

Calls 2

getProjectFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected