50 lines
847 B
JavaScript
50 lines
847 B
JavaScript
import React from 'react'
|
|
|
|
import PatientForm from '../components/patients/PatientForm'
|
|
|
|
import {useEffect, useState} from 'react'
|
|
|
|
const EditPage = ( {id}) => {
|
|
|
|
const [PatientToPUT, setPatientPUT] = useState({})
|
|
|
|
var requestOptions = {
|
|
method: 'GET',
|
|
redirect: 'follow'
|
|
};
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${id}`, requestOptions)
|
|
.then(response => response.json())
|
|
.then(result => result.data)
|
|
.then(data => console.log(data))
|
|
.catch(error => console.log('error', error));
|
|
|
|
}, [])
|
|
const HandlePutPatient = () => {
|
|
|
|
console.log('paciente atualizado')
|
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<PatientForm
|
|
onSave={HandlePutPatient}
|
|
onCancel={console.log('Não atualizar')}
|
|
PatientDict={PatientToPUT}
|
|
|
|
/>
|
|
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default EditPage |