added new Resource todo
This commit is contained in:
13
src/App.tsx
13
src/App.tsx
@@ -1,4 +1,4 @@
|
|||||||
import { Admin, Resource,} from "react-admin";
|
import { Admin, Resource } from "react-admin";
|
||||||
//import { Layout } from "./Layout";//
|
//import { Layout } from "./Layout";//
|
||||||
import { dataProvider } from "./dataProvider";
|
import { dataProvider } from "./dataProvider";
|
||||||
import { authProvider } from "./authProvider";
|
import { authProvider } from "./authProvider";
|
||||||
@@ -18,9 +18,17 @@ import { AlbumList } from "./components/albums/AlbumList.tsx";
|
|||||||
import { PhotoList } from "./components/photos/PhotoList.tsx";
|
import { PhotoList } from "./components/photos/PhotoList.tsx";
|
||||||
import { PhotoShow } from "./components/photos/PhotoShow.tsx";
|
import { PhotoShow } from "./components/photos/PhotoShow.tsx";
|
||||||
import { AlbumShow } from "./components/albums/AlbumShow.tsx";
|
import { AlbumShow } from "./components/albums/AlbumShow.tsx";
|
||||||
|
import { TodoList } from "./components/todos/TodoList.tsx";
|
||||||
|
import { TodoEdit } from "./components/todos/TodoEdit.tsx";
|
||||||
|
import { TodoShow } from "./components/todos/TodoShow.tsx";
|
||||||
|
|
||||||
export const App = () => (
|
export const App = () => (
|
||||||
<Admin layout={MyLayout} dataProvider={dataProvider} authProvider={authProvider} requireAuth>
|
<Admin
|
||||||
|
layout={MyLayout}
|
||||||
|
dataProvider={dataProvider}
|
||||||
|
authProvider={authProvider}
|
||||||
|
requireAuth
|
||||||
|
>
|
||||||
<Resource name="users" list={UserList} edit={UserEdit} show={UserShow} />
|
<Resource name="users" list={UserList} edit={UserEdit} show={UserShow} />
|
||||||
<Resource name="posts" list={PostList} edit={PostEdit} show={PostShow} />
|
<Resource name="posts" list={PostList} edit={PostEdit} show={PostShow} />
|
||||||
<Resource
|
<Resource
|
||||||
@@ -41,6 +49,7 @@ export const App = () => (
|
|||||||
edit={PhotoEdit}
|
edit={PhotoEdit}
|
||||||
show={PhotoShow}
|
show={PhotoShow}
|
||||||
/>
|
/>
|
||||||
|
<Resource name="todos" list={TodoList} edit={TodoEdit} show={TodoShow} />
|
||||||
</Admin>
|
</Admin>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
12
src/components/todos/TodoEdit.tsx
Normal file
12
src/components/todos/TodoEdit.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { BooleanInput, Edit, ReferenceInput, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const TodoEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="userId" reference="users" />
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="title" />
|
||||||
|
<BooleanInput source="completed" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
12
src/components/todos/TodoList.tsx
Normal file
12
src/components/todos/TodoList.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { BooleanField, Datagrid, List, ReferenceField, TextField } from 'react-admin';
|
||||||
|
|
||||||
|
export const TodoList = () => (
|
||||||
|
<List>
|
||||||
|
<Datagrid>
|
||||||
|
<ReferenceField source="userId" reference="users" />
|
||||||
|
<TextField source="id" />
|
||||||
|
<TextField source="title" />
|
||||||
|
<BooleanField source="completed" />
|
||||||
|
</Datagrid>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
12
src/components/todos/TodoShow.tsx
Normal file
12
src/components/todos/TodoShow.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { BooleanField, ReferenceField, Show, SimpleShowLayout, TextField } from 'react-admin';
|
||||||
|
|
||||||
|
export const TodoShow = () => (
|
||||||
|
<Show>
|
||||||
|
<SimpleShowLayout>
|
||||||
|
<ReferenceField source="userId" reference="users" />
|
||||||
|
<TextField source="id" />
|
||||||
|
<TextField source="title" />
|
||||||
|
<BooleanField source="completed" />
|
||||||
|
</SimpleShowLayout>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user