use fetchWrapper for getUserToValidate.js

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-01-30 14:41:25 +01:00
parent c11bb849c5
commit c43b411bac
2 changed files with 6 additions and 21 deletions
+4 -20
View File
@@ -1,21 +1,5 @@
import fetchWrapper from "../fetchWrapper.js";
export default async function getUserToValidate() {
try {
const res = await fetch(`${import.meta.env.VITE_API_URL}/api/users/invalid`, {
method: 'GET',
credentials: 'include',
headers: {
'Accept': 'application/json'
}
});
if (!res.ok) {
throw new Error(`Erreur serveur : ${res.status}`);
}
const data = await res.json();
return data;
} catch (err) {
console.error('Erreur :', err);
return null;
}
}
return fetchWrapper("/api/users/invalid");
}