Continue with file manager code cleanup

This commit is contained in:
Dane Everitt 2020-07-10 22:38:07 -07:00
parent 2692e98cd8
commit 5da9824fb7
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 89 additions and 150 deletions

View file

@ -0,0 +1,15 @@
import useSWR from 'swr';
import loadDirectory, { FileObject } from '@/api/server/files/loadDirectory';
import { cleanDirectoryPath } from '@/helpers';
import useServer from '@/plugins/useServer';
import { useLocation } from 'react-router';
export default () => {
const { uuid } = useServer();
const { hash } = useLocation();
return useSWR<FileObject[]>(
`${uuid}:files:${hash}`,
() => loadDirectory(uuid, cleanDirectoryPath(hash)),
);
};