Skip to content

Commit

Permalink
closes #109, added refetch interval to core info in setup page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ynng committed Jan 19, 2023
1 parent c6a8da7 commit c39a05d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/data/SystemInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface CoreInfo {
* Will change the core status to success if the connection is successful
* Will change the core status to error if the connection is unsuccessful
*/
export const useCoreInfo = () => {
export const useCoreInfo = (refetchInterval: number | false = false) => {
const { setCoreConnectionStatus } = useContext(LodestoneContext);
return useQuery<CoreInfo, AxiosError>(
['systeminfo', 'CoreInfo'],
Expand All @@ -75,6 +75,7 @@ export const useCoreInfo = () => {
onError: () => {
setCoreConnectionStatus('error');
},
refetchInterval,
}
);
};
Expand Down
5 changes: 1 addition & 4 deletions src/pages/login/CoreSetupNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const validationSchema = yup.object({
const CoreSetupNew = () => {
useDocumentTitle('Setup new core - Lodestone');
const { navigateBack, setPathname } = useContext(BrowserLocationContext);
const { data: coreInfo } = useCoreInfo();
const { data: coreInfo } = useCoreInfo(3000);
const { setToken, core } = useContext(LodestoneContext);
const queryClient = useQueryClient();
const [setupKey, setSetupKey] = useState<string>('');
Expand Down Expand Up @@ -168,6 +168,3 @@ const CoreSetupNew = () => {
};

export default CoreSetupNew;
function setToken(token: string, socket: any) {
throw new Error('Function not implemented.');
}

0 comments on commit c39a05d

Please sign in to comment.