forked from RiseUP/riseup-squad23
Inicio do concerto da atualização
This commit is contained in:
parent
f0fba8010f
commit
83f88e34d7
@ -205,9 +205,6 @@ function PatientForm({ onSave, onCancel, formData, setFormData, isLoading }) {
|
||||
}
|
||||
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
/* if (!emailRegex.test(formData.email)) {
|
||||
throw new Error('Email inválido. Por favor, verifique o email digitado.');
|
||||
}*/
|
||||
|
||||
|
||||
await onSave({ ...formData, bmi: parseFloat(formData.bmi) || null });
|
||||
|
||||
@ -49,6 +49,7 @@ const authHeader = getAuthorizationHeader()
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?id=eq.${DoctorID}`,requestOptions);
|
||||
console.log(response)
|
||||
|
||||
} catch (error) {
|
||||
console.error("Erro ao atualizar paciente:", error);
|
||||
|
||||
@ -7,7 +7,7 @@ import { GetPatientByID } from '../components/utils/Functions-Endpoints/Patient'
|
||||
import API_KEY from '../components/utils/apiKeys'
|
||||
import {useNavigate, useParams } from 'react-router-dom'
|
||||
import { useAuth } from '../components/utils/AuthProvider'
|
||||
const EditPage = ( {id, setCurrentPage}) => {
|
||||
const EditPage = () => {
|
||||
const navigate = useNavigate()
|
||||
const Parametros = useParams()
|
||||
const [PatientToPUT, setPatientPUT] = useState({})
|
||||
@ -44,24 +44,23 @@ const HandlePutPatient = async () => {
|
||||
console.log("Enviando paciente para atualização:", PatientToPUT);
|
||||
|
||||
var requestOptions = {
|
||||
method: 'PUT',
|
||||
method: 'PATCH',
|
||||
headers: myHeaders,
|
||||
body: raw,
|
||||
redirect: 'follow'
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientID}`,requestOptions);
|
||||
|
||||
|
||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients?id=eq.${PatientID}`,requestOptions);
|
||||
console.log(response)
|
||||
|
||||
|
||||
if(response.ok === false){
|
||||
console.error("Erro ao atualizar paciente:");
|
||||
}
|
||||
else{
|
||||
|
||||
console.log("ATUALIZADO COM SUCESSO");
|
||||
navigate('/pacientes')
|
||||
navigate('/secretaria/pacientes')
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user