Skip to content

Commit

Permalink
fix: Fixed routing issues with project switcher (#4828)
Browse files Browse the repository at this point in the history
Signed-off-by: Hrishav <[email protected]>
  • Loading branch information
hrishavjha committed Aug 14, 2024
1 parent 50a66ff commit d827c32
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useStrings } from '@strings';
import ProjectDashboardCardMenuController from '@controllers/ProjectDashboardCardMenu';
import { setUserDetails, toSentenceCase } from '@utils';
import { useAppStore } from '@context';
import { useRouteWithBaseUrl } from '@hooks';
import css from './ProjectDashboardCardContainer.module.scss';

interface ProjectDashboardCardProps {
Expand All @@ -25,16 +24,16 @@ export default function ProjectDashboardCardContainer(props: ProjectDashboardCar
const [projectIdToDelete, setProjectIdToDelete] = useState<string>();
const { getString } = useStrings();
const history = useHistory();
const { updateAppStore } = useAppStore();

const paths = useRouteWithBaseUrl();
const { updateAppStore, currentUserInfo } = useAppStore();

const handleProjectSelect = (project: Project): void => {
const projectRole = project.members?.find(member => member.userID === currentUserInfo?.ID)?.role;
updateAppStore({ projectID: project.projectID, projectName: project.name });
setUserDetails({
projectRole,
projectID: project.projectID
});
history.push(paths.toRoot());
history.replace(`/`);
};

return (
Expand Down

0 comments on commit d827c32

Please sign in to comment.