You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/hooks/useFetchLatestReleaseFromFi...

16 lines
578 B
TypeScript

import { useSelector } from 'react-redux';
import useInterval from 'react-use/lib/useInterval';
import { getOurPrimaryConversation } from '../state/selectors/conversations';
import { fetchLatestRelease } from '../session/fetch_latest_release';
export function useFetchLatestReleaseFromFileServer() {
const ourPrimaryConversation = useSelector(getOurPrimaryConversation);
useInterval(() => {
if (!ourPrimaryConversation) {
return;
}
void fetchLatestRelease.fetchReleaseFromFSAndUpdateMain();
}, fetchLatestRelease.fetchReleaseFromFileServerInterval);
}