Skip to content

Commit

Permalink
remove user from waiting automatically if tab closed or returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranshu1902 committed Nov 27, 2023
1 parent a924c1f commit 29f8235
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Components/Facility/Consultations/LiveFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ const LiveFeed = (props: any) => {
Notification.Success({ msg: data?.message });
};

// remove user from waiting list if they close the tab or move away
useEffect(() => {
if (inWaiting) {
window.addEventListener("beforeunload", removeFromWaitingList);
}
}, [inWaiting]);

// lock and unlock asset methods
const lockAsset = async () => {
const response = await request(routes.lockAsset, {
Expand Down

0 comments on commit 29f8235

Please sign in to comment.