diff --git a/frontend/src/data/reports.js b/frontend/src/data/reports.js index ee18bf7..ade980f 100644 --- a/frontend/src/data/reports.js +++ b/frontend/src/data/reports.js @@ -135,10 +135,19 @@ export async function getEmailByUserId(id) { }, }); - const data = await response.json(); - return data.email; + if (response.ok) { + const data = await response.json(); + return data.email; + } else { + return null; + } } catch (error) { - console.error("Errore da getEmailByUserId(" + id + "): ", error); + if (response.status === 404) { + console.error("Utente rimosso!"); + } else { + console.error("Errore da getEmailByUserId(" + id + "): ", error); + } + return null; } } diff --git a/frontend/src/states/loggedUser.js b/frontend/src/states/loggedUser.js index daf6b8b..5c698a8 100644 --- a/frontend/src/states/loggedUser.js +++ b/frontend/src/states/loggedUser.js @@ -35,7 +35,7 @@ function setLoggedUser(data) { loggedUser.updatedAt = data.updatedAt; // Save to cookies - Cookies.set('loggedUser', JSON.stringify(loggedUser), { expires: 7 }); // expires in 7 days + Cookies.set('loggedUser', JSON.stringify(loggedUser), { expires: 90 }); // expires in 3 months } function clearLoggedUser() { diff --git a/frontend/src/views/dashboard/ViewDashboard.vue b/frontend/src/views/dashboard/ViewDashboard.vue index ad53eaf..09f72d8 100644 --- a/frontend/src/views/dashboard/ViewDashboard.vue +++ b/frontend/src/views/dashboard/ViewDashboard.vue @@ -1,7 +1,7 @@