Merge branch 'dev' into 'features/manageMember'

# Conflicts:
#   src/utils/users/deleteUser.js
This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-01-13 22:40:56 +00:00
13 changed files with 582 additions and 181 deletions
+21
View File
@@ -0,0 +1,21 @@
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;
}
}
+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(
`${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;
}
}