validate + delete user + last event + prototype chart

This commit is contained in:
p2405951
2026-01-13 11:49:11 +01:00
parent 263e7fea46
commit b0f0aec16e
7 changed files with 194 additions and 233 deletions
+27
View File
@@ -0,0 +1,27 @@
import getXSRFToken from "../getXSRF.js";
export default async function validateUser(userId) {
const csrfToken = await getXSRFToken();
try {
const res = await fetch(
`http://${import.meta.env.VITE_API_URL}/api/users/${userId}/validate`,
{
method: "POST",
credentials: "include",
headers: {
Accept: "application/json",
'X-XSRF-TOKEN': csrfToken,
},
}
);
if (!res.ok) {
const errorData = await res.json();
console.error("Erreur backend:", errorData);
return false;
}
return true;
} catch (err) {
console.error("Erreur réseau:", err);
return false;
}
}