diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Other/NoData.tsx | 9 | ||||
-rw-r--r-- | src/pages/Recent.tsx | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/components/Other/NoData.tsx b/src/components/Other/NoData.tsx new file mode 100644 index 0000000..c1236c1 --- /dev/null +++ b/src/components/Other/NoData.tsx @@ -0,0 +1,9 @@ +export default function NoData() { + return ( + <> + <div className="block bg-white-500 border border-gray-200 rounded-lg shadow"> + <div>No data</div> + </div> + </> + ) +} diff --git a/src/pages/Recent.tsx b/src/pages/Recent.tsx index b0e0601..1578905 100644 --- a/src/pages/Recent.tsx +++ b/src/pages/Recent.tsx @@ -8,6 +8,8 @@ export default function Recent(props: any) { const [files, setFiles] = useState([]) + const [paginationOffset, setPaginationOffset] = useState(0); + useEffect(() => { if (!props.session) { navigate('/login') @@ -15,27 +17,33 @@ export default function Recent(props: any) { }, [props.session]) const fetchFiles = useCallback(async () => { + console.log("FETCHIN FILES") const { data, error } = await props.supabase .from('file') - .select() + .select().limit(10).offset(paginationOffset) if (error) { console.error(error) return } + console.log("FETCHED FILES") setFiles(data.map((file: any) => { return file as File })) }, [props.supabase]) useEffect(() => { + console.log("Aaa") fetchFiles() - }, []) + }, [paginationOffset]) return ( <> <div className="flex h-screen"> <SideBar currentPage="Recent" /> <main className="flex-1 overflow-y-auto"> + <button onClick={() => setPaginationOffset(paginationOffset + 1)}> + clickmeforpaginate + </button> <div> {files.map((file: any) => ( <div key={file.id}> |