mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 07:46:00 +00:00
15 lines
494 B
JavaScript
15 lines
494 B
JavaScript
import React from 'react';
|
|
import { useOpenedConnections } from './globalState';
|
|
import axios from './axios';
|
|
|
|
export default function OpenedConnectionsPinger({ children }) {
|
|
const openedConnections = useOpenedConnections();
|
|
React.useEffect(() => {
|
|
const handle = window.setInterval(() => {
|
|
axios.post('server-connections/ping', { connections: openedConnections });
|
|
}, 30 * 1000);
|
|
return () => window.clearInterval(handle);
|
|
}, [openedConnections]);
|
|
return children;
|
|
}
|