Jayden Seric 8a46155f91 Simplify the example by removing the DB.
This avoids trying to figure out how to fix concurrent writes conflicting with `lowdb` v2, see: https://github.com/typicode/lowdb/issues/478 .
2021-06-11 17:24:42 +10:00

36 lines
710 B
JavaScript

import { gql, useQuery } from '@apollo/client';
import Scroll from 'device-agnostic-ui/public/components/Scroll.js';
import Table from 'device-agnostic-ui/public/components/Table.js';
const UPLOADS_QUERY = gql`
query uploads {
uploads {
id
url
}
}
`;
export function Uploads() {
const { data: { uploads = [] } = {} } = useQuery(UPLOADS_QUERY);
return (
<Scroll>
<Table>
<thead>
<tr>
<th>Stored file URL</th>
</tr>
</thead>
<tbody>
{uploads.map(({ id, url }) => (
<tr key={id}>
<td>{url}</td>
</tr>
))}
</tbody>
</Table>
</Scroll>
);
}