Reputation: 4230
I simply want all of my admin pages to be under /admin
.
<Admin
title="Admin"
dashboard={Dashboard}
dataProvider={restClient}
history={history}
>
<Resource
name="users"
list={UserList}
/>
</Admin>
My main page is at /admin
but when I click Users in the sidebar, it changes the path to /users
and not /admin/users
.
I'm using react-admin 2.0.0.
Upvotes: 3
Views: 1371
Reputation: 1
Not sure it is going to work for all versions. In my case, the solution with history has not worked. I've done the following approach:
<Admin basename="/admin">
Upvotes: 0
Reputation: 81
We had to use nginx and host two completely different apps to do this. It does not seem easy at all to integrate react-admin with another application already using react-router. The documentation provides some help, but the documentation also is often difficult to follow so I was very trepidatious of copying and pasting it's code to try and do this.
Ovverall I've been more frustrated with react-admin the longer I use it; I think there are some great things about the project but the documentation is not well-organized, there's no easy-to-read API reference, and there are a lot of leaky abstractions in that you really have to understand the material-ui, react-final-forms, and of course react-router packages to do anything even remotely 'outside the box' with react-admin.
Sorry to vent, but, my two cents is, split the app or use a different tool.
Upvotes: 0
Reputation: 4230
The key is actually in the history prop passed to the Admin component:
import createHistory from 'history/createBrowserHistory';
const history = createHistory({ basename: '/admin' });
<Admin history={history} />
Upvotes: 11