Refactor fetchWeeklyReport function, updated submit button text, week fetched by params
This commit is contained in:
parent
d0d0e311e5
commit
5803c7b29b
1 changed files with 35 additions and 34 deletions
|
@ -16,13 +16,13 @@ export default function GetWeeklyReport(): JSX.Element {
|
|||
const token = localStorage.getItem("accessToken") ?? "";
|
||||
const username = localStorage.getItem("username") ?? "";
|
||||
const { projectName } = useParams();
|
||||
const { fetchedWeek } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchWeeklyReport = async (): Promise<void> => {
|
||||
const response = await api.getWeeklyReport(
|
||||
username,
|
||||
projectName ?? "",
|
||||
week.toString(),
|
||||
fetchedWeek?.toString() ?? "0",
|
||||
token,
|
||||
);
|
||||
|
||||
|
@ -50,8 +50,9 @@ export default function GetWeeklyReport(): JSX.Element {
|
|||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
void fetchWeeklyReport();
|
||||
}, [projectName, token, username, week]);
|
||||
});
|
||||
|
||||
const handleNewWeeklyReport = async (): Promise<void> => {
|
||||
const newWeeklyReport: NewWeeklyReport = {
|
||||
|
@ -233,7 +234,7 @@ export default function GetWeeklyReport(): JSX.Element {
|
|||
</tbody>
|
||||
</table>
|
||||
<Button
|
||||
text="Submit"
|
||||
text="Submit changes"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
|
|
Loading…
Add table
Reference in a new issue