Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatrakazas committed Nov 15, 2024
1 parent b2a3e90 commit b979656
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/context/StatusContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ async function checkInternetConnection(): Promise<boolean> {
});
return response.status === 200;
} catch (error) {
if (error.code === 'ECONNABORTED') {
console.error('Backend connection timed out');
} else {
console.error('Error checking backend connection:', error);
}
return false;
}
}
Expand Down Expand Up @@ -97,7 +92,7 @@ export const StatusProvider = ({ children }: { children: React.ReactNode }) => {
const rtt = endTime - startTime;

const newSpeed = calculateNetworkSpeed(rtt);
console.log('NEW SPEED',newSpeed);
console.log('NEW SPEED', newSpeed);
setConnectivity((prev) => {
if (prev.speed !== newSpeed) {
return { ...prev, speed: newSpeed };
Expand All @@ -122,16 +117,16 @@ export const StatusProvider = ({ children }: { children: React.ReactNode }) => {
}
return prev;
});
} else {
const newSpeed = calculateNetworkSpeed(rtt);
console.log('NEW SPEED', newSpeed);
setConnectivity((prev) => {
if (prev.speed !== newSpeed) {
return { ...prev, speed: newSpeed };
}
return prev;
});
}

const newSpeed = calculateNetworkSpeed(rtt);
console.log('NEW SPEED',newSpeed);
setConnectivity((prev) => {
if (prev.speed !== newSpeed) {
return { ...prev, speed: newSpeed };
}
return prev;
});
}
return Promise.reject(error);
}
Expand Down

0 comments on commit b979656

Please sign in to comment.