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@]+$/;
|
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 });
|
await onSave({ ...formData, bmi: parseFloat(formData.bmi) || null });
|
||||||
|
|||||||
@ -49,6 +49,7 @@ const authHeader = getAuthorizationHeader()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?id=eq.${DoctorID}`,requestOptions);
|
const response = await fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors?id=eq.${DoctorID}`,requestOptions);
|
||||||
|
console.log(response)
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Erro ao atualizar paciente:", 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 API_KEY from '../components/utils/apiKeys'
|
||||||
import {useNavigate, useParams } from 'react-router-dom'
|
import {useNavigate, useParams } from 'react-router-dom'
|
||||||
import { useAuth } from '../components/utils/AuthProvider'
|
import { useAuth } from '../components/utils/AuthProvider'
|
||||||
const EditPage = ( {id, setCurrentPage}) => {
|
const EditPage = () => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const Parametros = useParams()
|
const Parametros = useParams()
|
||||||
const [PatientToPUT, setPatientPUT] = useState({})
|
const [PatientToPUT, setPatientPUT] = useState({})
|
||||||
@ -44,24 +44,23 @@ const HandlePutPatient = async () => {
|
|||||||
console.log("Enviando paciente para atualização:", PatientToPUT);
|
console.log("Enviando paciente para atualização:", PatientToPUT);
|
||||||
|
|
||||||
var requestOptions = {
|
var requestOptions = {
|
||||||
method: 'PUT',
|
method: 'PATCH',
|
||||||
headers: myHeaders,
|
headers: myHeaders,
|
||||||
body: raw,
|
body: raw,
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
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){
|
if(response.ok === false){
|
||||||
console.error("Erro ao atualizar paciente:");
|
console.error("Erro ao atualizar paciente:");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
console.log("ATUALIZADO COM SUCESSO");
|
console.log("ATUALIZADO COM SUCESSO");
|
||||||
navigate('/pacientes')
|
navigate('/secretaria/pacientes')
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user