-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
customRouteLayout.js
44 lines (39 loc) · 1.05 KB
/
customRouteLayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as React from 'react';
import {
useGetList,
useAuthenticated,
Datagrid,
TextField,
Title,
} from 'react-admin';
const currentSort = { field: 'published_at', order: 'DESC' };
const CustomRouteLayout = () => {
useAuthenticated();
const { ids, data, total, loaded } = useGetList(
'posts',
{ page: 1, perPage: 10 },
currentSort
);
return loaded ? (
<div>
<Title title="Example Admin" />
<h1>Posts</h1>
<p>
Found <span className="total">{total}</span> posts !
</p>
<Datagrid
basePath=""
currentSort={currentSort}
data={data}
ids={ids}
selectedIds={[]}
loaded={loaded}
total={total}
>
<TextField source="id" sortable={false} />
<TextField source="title" sortable={false} />
</Datagrid>
</div>
) : null;
};
export default CustomRouteLayout;