troca-de-API #9

Merged
lucasrodrigues-bit2 merged 13 commits from StsDanilo/riseup-squad21:troca-de-API into troca-de-API 2025-09-29 20:03:33 +00:00
2 changed files with 3 additions and 6 deletions
Showing only changes of commit 7455a57891 - Show all commits

View File

@ -30,7 +30,6 @@ export default function PacientesPage() {
setPatientDetails(null); setPatientDetails(null);
try { try {
const res = await patientsService.getById(patientId); const res = await patientsService.getById(patientId);
console.log(res)
setPatientDetails(res[0]); setPatientDetails(res[0]);
} catch (e: any) { } catch (e: any) {
setPatientDetails({ error: e?.message || "Erro ao buscar detalhes" }); setPatientDetails({ error: e?.message || "Erro ao buscar detalhes" });

View File

@ -17,18 +17,16 @@ async function login() {
const data = await response.json(); const data = await response.json();
console.log(data.access_token) console.log(data.access_token)
// salvar o token do usuário // salvar o token do usuário
//localStorage.setItem("token", data.access_token); localStorage.setItem("token", data.access_token);
tempToken = data.access_token
return data; return data;
} }
await login() await login()
async function request(endpoint, options = {}) { async function request(endpoint, options = {}) {
//const token = localStorage.getItem("token"); // token do usuário, salvo no login const token = localStorage.getItem("token"); // token do usuário, salvo no login
const token = tempToken;
console.log(`endpoint: ${endpoint}`)
const headers = { const headers = {
"Content-Type": "application/json", "Content-Type": "application/json",