Files
SAE-BUT2/src/utils/notifications/getUserNotifications.js
T
2025-12-17 14:16:08 +01:00

22 lines
609 B
JavaScript

export default async function getUserNotifications(id) {
try {
const response = await fetch(
`http://${import.meta.env.VITE_API_URL}/api/users/${id}/notifications`,
{
method: 'GET',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}
);
const data = await response.json();
return data.data;
} catch (err) {
console.error("Erreur :", err);
return null;
}
}