Skip to content

Commit

Permalink
remove notifications logic from useCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
anyoussefinia committed Nov 11, 2024
1 parent 6da7d0e commit ccb079a
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions services/ui-src/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,31 @@ const App = () => {
const userData = await UserDataApi.userProfile(email);
// set the notifications: Needs to be stored locally to persist on reload
// Check local storage for notifications
if(mmdlNotification){
console.log("mmdl notification in useCallback true")
const storedNotifications = localStorage.getItem(
LOCAL_STORAGE_USERNOTIFICATIONS
);
console.log("stored notificaitons: " +storedNotifications)
console.log("storedNotifications?.length: " + storedNotifications?.length)
if (storedNotifications !== undefined && storedNotifications?.length && storedNotifications.length > 2) {
console.log("first If ")
userData.notifications = JSON.parse(storedNotifications);
} else {
console.log("else")
// get the notifications & set local storage
const notifications = await NotificationsApi.createUserNotifications(
email
);
userData.notifications = notifications;
if(notifcations) {
localStorage.setItem(
LOCAL_STORAGE_USERNOTIFICATIONS,
JSON.stringify(notifications)
);
}
}
}
// if(mmdlNotification){
// console.log("mmdl notification in useCallback true")
// const storedNotifications = localStorage.getItem(
// LOCAL_STORAGE_USERNOTIFICATIONS
// );
// console.log("stored notificaitons: " +storedNotifications)
// console.log("storedNotifications?.length: " + storedNotifications?.length)
// if (storedNotifications !== undefined && storedNotifications?.length && storedNotifications.length > 2) {
// console.log("first If ")
// userData.notifications = JSON.parse(storedNotifications);
// } else {
// console.log("else")
// // get the notifications & set local storage
// const notifications = await NotificationsApi.createUserNotifications(
// email
// );
// userData.notifications = notifications;
// if(notifcations) {
// localStorage.setItem(
// LOCAL_STORAGE_USERNOTIFICATIONS,
// JSON.stringify(notifications)
// );
// }
// }
// }

const roleResult = effectiveRoleForUser(userData?.roleList);
let userRole = null,
Expand Down

0 comments on commit ccb079a

Please sign in to comment.