Refactor fetchWeeklyReport in EditWeeklyReport component
This commit is contained in:
parent
7c73a01d4c
commit
48e4d1a8df
1 changed files with 38 additions and 35 deletions
|
@ -18,13 +18,17 @@ export default function GetWeeklyReport(): JSX.Element {
|
|||
const [testingTime, setTestingTime] = useState(0);
|
||||
|
||||
const token = localStorage.getItem("accessToken") ?? "";
|
||||
const { projectName } = useParams();
|
||||
const { fetchedWeek } = useParams();
|
||||
const { projectName, fetchedWeek } = useParams<{
|
||||
projectName: string;
|
||||
fetchedWeek: string;
|
||||
}>();
|
||||
console.log(projectName, fetchedWeek);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchWeeklyReport = async (): Promise<void> => {
|
||||
const response = await api.getWeeklyReport(
|
||||
projectName ?? "",
|
||||
fetchedWeek?.toString() ?? "0",
|
||||
fetchedWeek ?? "",
|
||||
token,
|
||||
);
|
||||
|
||||
|
@ -53,9 +57,8 @@ export default function GetWeeklyReport(): JSX.Element {
|
|||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
void fetchWeeklyReport();
|
||||
});
|
||||
}, [projectName, fetchedWeek, token]);
|
||||
|
||||
const handleNewWeeklyReport = async (): Promise<void> => {
|
||||
const newWeeklyReport: NewWeeklyReport = {
|
||||
|
|
Loading…
Reference in a new issue