fixed dep array

This commit is contained in:
al8763be 2024-03-20 23:24:28 +01:00
parent a2a8ccd185
commit 01b934969a

View file

@ -13,6 +13,8 @@ function AllTimeReportsInProject(): JSX.Element {
const { projectName } = useParams();
const [weeklyReports, setWeeklyReports] = useState<WeeklyReport[]>([]);
// Call getProjects when the component mounts
useEffect(() => {
const getWeeklyReports = async (): Promise<void> => {
const token = localStorage.getItem("accessToken") ?? "";
const response = await api.getWeeklyReportsForUser(
@ -27,10 +29,8 @@ function AllTimeReportsInProject(): JSX.Element {
}
};
// Call getProjects when the component mounts
useEffect(() => {
void getWeeklyReports();
}, []);
}, [projectName]);
return (
<>