Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Fix non-Admin snippet in custom app documentation #2493

Merged
merged 1 commit into from
Nov 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions docs/CustomApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,18 @@ const App = () => (
- <Resource name="comments" list={CommentList} edit={CommentEdit} create={CommentCreate} />
- <Resource name="users" list={UserList} edit={UserEdit} create={UserCreate} />
+ <TranslationProvider>
+ <ConnectedRouter history={history}>
+ <MuiThemeProvider>
+ <Resource name="posts" context="registration" />
+ <Resource name="comments" context="registration" />
+ <Resource name="users" context="registration" />
+ <MuiThemeProvider>
+ <AppBar position="static" color="default">
+ <Toolbar>
+ <Typography variant="title" color="inherit">
+ My admin
+ </Typography>
+ </Toolbar>
+ </AppBar>
+ <AppBar position="static" color="default">
+ <Toolbar>
+ <Typography variant="title" color="inherit">
+ My admin
+ </Typography>
+ </Toolbar>
+ </AppBar>
+ <ConnectedRouter history={history}>
+ <Switch>
+ <Route exact path="/" component={Dashboard} />
+ <Route exact path="/posts" hasCreate render={(routeProps) => <PostList resource="posts" {...routeProps} />} />
Expand All @@ -226,8 +226,8 @@ const App = () => (
+ <Route exact path="/users/create" render={(routeProps) => <UsersCreate resource="users" {...routeProps} />} />
+ <Route exact path="/users/:id" render={(routeProps) => <UsersEdit resource="users" {...routeProps} />} />
+ </Switch>
+ </MuiThemeProvider>
+ </ConnectedRouter>
+ </ConnectedRouter>
+ </MuiThemeProvider>
+ </TranslationProvider>
- </Admin>
</Provider>
Expand All @@ -239,6 +239,7 @@ const App = () => (
+ authProvider: PropTypes.func,
+ },
+ () => ({ authProvider })
+)(App);
```

Note that this example still uses `<Resource>`, because this component lazily initializes the store for the resource data.
Expand Down