get db events

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2025-12-07 01:07:27 +01:00
parent 191044e520
commit d2e95744b8
3 changed files with 55 additions and 151 deletions
+23
View File
@@ -0,0 +1,23 @@
export default async function getAllEvents() {
try {
const res = await fetch(`http://${import.meta.env.VITE_API_URL}/api/events/`, {
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;
}
}