Skip to content

Commit

Permalink
Adicionando US53 (Pequeno bug a corrigir)
Browse files Browse the repository at this point in the history
Co-authored-by: Artur <[email protected]>
  • Loading branch information
JoaoBarreto03 and ArturRSA19 committed Dec 11, 2023
1 parent 6b74656 commit 2eb82f7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions frontend/src/pages/ViewPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { saveAs } from 'file-saver';

const ViewPlan = () => {
const { id } = useParams();
const { idDrill } = useParams();
const [title, setTitle] = useState('');
const [titleAux, setTitleAux] = useState('');
const [goals, setGoals] = useState('');
Expand Down Expand Up @@ -41,6 +42,7 @@ const ViewPlan = () => {
userId = '';
}


const [titleDrill, setTitleDrill] = useState('');
const [descriptionDrill, setDescriptionDrill] = useState('');
const [observationsDrill, setObservationsDrill] = useState('');
Expand Down Expand Up @@ -69,8 +71,8 @@ const ViewPlan = () => {
}

async function loadDataDrill() {
if (id != null) {
const response = await drill.getById(id);
if (idDrill != null) {
const response = await drill.getById(idDrill);
setDrillUpdated(response.data);
}
}
Expand Down Expand Up @@ -154,10 +156,10 @@ const ViewPlan = () => {

useEffect(() => {
loadDataDrill();
setTitleDrill(titleDrill);
setDescriptionDrill(descriptionDrill);
setObservationsDrill(observationsDrill);
}, [titleDrill, descriptionDrill, observationsDrill]);
setTitleDrill(drillUpdated.title);
setDescriptionDrill(drillUpdated.description);
setObservationsDrill(drillUpdated.observations);
}, [drillUpdated]);



Expand Down Expand Up @@ -252,11 +254,10 @@ const ViewPlan = () => {
goals: planUpdated.goals,
observations: planUpdated.observations,
},
drills: drills.map((drill) => ({
title: drillUpdated.title,
description: drillUpdated.description,
observations: drillUpdated.observations,

drills: drills.map((Drill) => ({
title: Drill.title || '',
description: Drill.description || '',
observations: Drill.observations || '',
})),
};

Expand Down

0 comments on commit 2eb82f7

Please sign in to comment.