Creating File Statistics page.

This commit is contained in:
Roland 2022-12-15 11:48:46 -07:00
parent fef8e123a0
commit e24990aae2
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
7 changed files with 165 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import {
getDownloaders,
getDownloads,
getFiles,
getFileStatistics,
getInventory,
getSettings,
getStatistics,
@ -718,3 +719,22 @@ export const useInventory = (inventoryId) => {
return {byCategory, bySubcategory, byName, fetchInventory}
}
export const useFileStatistics = () => {
const [statistics, setStatistics] = useState();
const fetchFileStatistics = async () => {
try {
const statistics = await getFileStatistics();
setStatistics(statistics || undefined);
} catch (e) {
console.error(e);
}
}
useEffect(() => {
fetchFileStatistics();
}, []);
return {statistics};
}