 import React from 'react'

 import DoctorForm from '../components/doctors/DoctorForm'

 import {useEffect, useState} from 'react'


const [DoctorToPUT, setDoctorPUT] = useState({})


 const DoctorEditPage = ( {id}) => {


   var requestOptions = {
    method: 'GET',
    redirect: 'follow'
 };

 useEffect(() => {
    console.log(DoctorToPUT)
 },[DoctorToPUT])

 useEffect(() => {
    setDoctorPUT({nome:'kkddd'})

/*
 fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${id}`, requestOptions)
   .then(response => response.json())
   .then(result => result.data)
   .then(data => setDoctorPUT(data))

   .catch(error => console.log('error', error));
  */  
 }, [])

   const HandlePutDoctor = () => {

     console.log('médico atualizado')

   }


   return (
     <div>
        <h2>Editar dados do médico</h2>
        <button>Voltar para lista sem salvar</button>

    
    <DoctorForm
    onSave={HandlePutDoctor}
    onCancel={() => console.log('cancelar edição')}
    DoctorDict={DoctorToPUT}
    />

   </div>
 )}

export default DoctorEditPage;