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);
try {
const res = await patientsService.getById(patientId);
console.log(res)
setPatientDetails(res[0]);
} catch (e: any) {
setPatientDetails({ error: e?.message || "Erro ao buscar detalhes" });

View File

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