Refactor getUnsignedReports in DisplayUnsignedReports component
This commit is contained in:
parent
0b8b430f38
commit
1e1677fc57
1 changed files with 15 additions and 17 deletions
|
@ -11,7 +11,7 @@ function DisplayUserProject(): JSX.Element {
|
|||
const { projectName } = useParams();
|
||||
const [unsignedReports, setUnsignedReports] = useState<WeeklyReport[]>([]);
|
||||
//const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const getUnsignedReports = async (): Promise<void> => {
|
||||
const token = localStorage.getItem("accessToken") ?? "";
|
||||
const response = await api.getUnsignedReportsInProject(
|
||||
|
@ -26,10 +26,8 @@ function DisplayUserProject(): JSX.Element {
|
|||
}
|
||||
};
|
||||
|
||||
// Call getProjects when the component mounts
|
||||
useEffect(() => {
|
||||
void getUnsignedReports();
|
||||
}, []);
|
||||
}, [projectName]); // Include 'projectName' in the dependency array
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue