refactor(project-view-enhanced-tasks): update project ID handling and improve error messaging

- Replaced use of `useParams` with `useAppSelector` to retrieve project information from the Redux store.
- Updated error message from "Project ID not found" to "Project not found" for better clarity.
- Adjusted the way the project ID is passed to the `TaskListBoard` component.
This commit is contained in:
chamikaJ
2025-06-18 17:10:14 +05:30
parent c01ef4579a
commit d0310ded28

View File

@@ -1,21 +1,21 @@
import React from 'react';
import { useParams } from 'react-router-dom';
import { useAppSelector } from '@/hooks/useAppSelector';
import TaskListBoard from '@/components/task-management/TaskListBoard';
const ProjectViewEnhancedTasks: React.FC = () => {
const { id: projectId } = useParams<{ id: string }>();
const { project } = useAppSelector(state => state.projectReducer);
if (!projectId) {
if (!project?.id) {
return (
<div className="p-4 text-center text-gray-500">
Project ID not found
Project not found
</div>
);
}
return (
<div className="project-view-enhanced-tasks">
<TaskListBoard projectId={projectId} />
<TaskListBoard projectId={project.id} />
</div>
);
};