mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 15:05:48 +01:00
More cleanup and history added
This commit is contained in:
21
src/tools/hooks/api.ts
Normal file
21
src/tools/hooks/api.ts
Normal 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,
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user