Files
SAE-BUT2/src/utils/notifications/getUserNotifications.ts
T

22 lines
594 B
TypeScript

export default async function getUserNotifications() {
try {
const response = await fetch(
`${import.meta.env.VITE_API_URL}/api/users/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;
}
}