More cleanup and history added

This commit is contained in:
Jannes Vandepitte
2022-08-25 21:07:41 +02:00
parent 4afa09fd7a
commit c44a01fbc3
10 changed files with 357 additions and 226 deletions

21
src/tools/hooks/api.ts Normal file
View File

@@ -0,0 +1,21 @@
import { useQuery } from '@tanstack/react-query';
import axios from 'axios';
import { UsenetHistoryItem, UsenetQueueItem } from '../../modules';
export const useGetUsenetDownloads = () =>
useQuery(
['usenetDownloads'],
async () => (await axios.get<UsenetQueueItem[]>('/api/modules/usenet')).data,
{
refetchInterval: 1000,
}
);
export const useGetUsenetHistory = () =>
useQuery(
['usenetHistory'],
async () => (await axios.get<UsenetHistoryItem[]>('/api/modules/usenet/history')).data,
{
refetchInterval: 1000,
}
);