nicer flow for disconnections, adding socket initialization and such

This commit is contained in:
talksik
2022-05-06 06:30:14 -05:00
parent 0f8902b47d
commit 0d8673d594
9 changed files with 269 additions and 137 deletions
+15 -1
View File
@@ -6,7 +6,20 @@ import { queryClient } from "../pages/nirvanaApp";
import { useRecoilValue } from "recoil";
// ====== QUERIES
export function useAuthCheck() {
/**
* ensure that the server is up
*/
export function useServerCheck() {
return useQuery("SERVER_CHECK", ApiCalls.serverCheck, {
retry: true,
refetchOnWindowFocus: false,
refetchInterval: 10000,
});
}
export function useAuthCheck(enabled: boolean = true) {
const jwtToken = useRecoilValue($jwtToken);
return useQuery("AUTH_CHECK", ApiCalls.authCheck, {
@@ -14,6 +27,7 @@ export function useAuthCheck() {
refetchOnWindowFocus: false,
refetchInterval: 10000,
enabled,
});
}