mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 21:12:09 +03:00
34 lines
976 B
JavaScript
34 lines
976 B
JavaScript
// assuming app.js inside src/App.js
|
|
import React from 'react';
|
|
import PostIcon from '@material-ui/icons/Book';
|
|
import UserIcon from '@material-ui/icons/Group';
|
|
import { Admin, Resource, ListGuesser } from 'react-admin';
|
|
import hasuraDataProvider from 'ra-data-hasura';
|
|
|
|
import { PostList, PostEdit, PostCreate, PostShow } from './posts';
|
|
import { UserList } from './users';
|
|
import Dashboard from './Dashboard';
|
|
import authProvider from './authProvider';
|
|
|
|
const headers = {'content-type': 'application/json'};
|
|
const App = () => (
|
|
<Admin
|
|
dataProvider={hasuraDataProvider('http://localhost:8080', headers)}
|
|
authProvider={authProvider}
|
|
dashboard={Dashboard}
|
|
>
|
|
<Resource
|
|
name="posts"
|
|
icon={PostIcon}
|
|
list={PostList}
|
|
edit={PostEdit}
|
|
create={PostCreate}
|
|
show={PostShow}
|
|
/>
|
|
<Resource name="users" icon={UserIcon} list={UserList} />
|
|
<Resource name="comments" list={ListGuesser} />
|
|
</Admin>
|
|
);
|
|
|
|
export default App;
|