Skip to content

Commit

Permalink
Update useOnline.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUltDev committed Apr 15, 2024
1 parent 05bd044 commit 699c73a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/core/hooks/useOnline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export function useOnline() {
const handleConnectivity = (connected: boolean, init?: boolean) => {
if (connected && !init) {
toast({title: t`You are online`, preset: 'done'});
} else if (connected) {
} else if (!connected) {
toast({title: t`You are offline`, preset: 'error'});
}
setOnline(connected);
}

useLingui();
useEffect(() => {
isOnline().then((online) => handleConnectivity(online, true));
isOnline().then(connected => handleConnectivity(connected, true));
return suscribeOnline(handleConnectivity);
}, []);

Expand Down

0 comments on commit 699c73a

Please sign in to comment.