mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 12:56:24 -05:00
Creating File Statistics page.
This commit is contained in:
parent
fef8e123a0
commit
e24990aae2
7 changed files with 165 additions and 2 deletions
|
|
@ -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};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue