Skip to content

Commit

Permalink
Merge pull request #9478 from marmelab/doc-fix-js
Browse files Browse the repository at this point in the history
[Doc] Fix snippets fails to render in JS
  • Loading branch information
slax57 committed Nov 28, 2023
2 parents c13243d + 1cabb7a commit 802bab4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions docs/Admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ You can also disable the `/login` route completely by passing `false` to this pr
const authProvider = {
// ...
async checkAuth() {
if (/* not authenticated */) {
// ...
if (!authenticated) {
throw { redirectTo: '/no-access' };
}
},
Expand Down Expand Up @@ -689,6 +690,7 @@ If you want to override the react-query default query and mutation default optio
```tsx
import { Admin } from 'react-admin';
import { QueryClient } from 'react-query';
import { dataProvider } from './dataProvider';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -703,7 +705,7 @@ const queryClient = new QueryClient({
});

const App = () => (
<Admin queryClient={queryClient} dataProvider={...}>
<Admin queryClient={queryClient} dataProvider={dataProvider}>
...
</Admin>
);
Expand Down Expand Up @@ -896,10 +898,11 @@ But you may want to use another routing strategy, e.g. to allow server-side rend
```tsx
import { BrowserRouter } from 'react-router-dom';
import { Admin, Resource } from 'react-admin';
import { dataProvider } from './dataProvider';

const App = () => (
<BrowserRouter>
<Admin dataProvider={...}>
<Admin dataProvider={dataProvider}>
<Resource name="posts" />
</Admin>
</BrowserRouter>
Expand All @@ -915,10 +918,11 @@ However, if you serve your admin from a sub path AND use another Router (like [`
```tsx
import { Admin, Resource } from 'react-admin';
import { BrowserRouter } from 'react-router-dom';
import { dataProvider } from './dataProvider';

const App = () => (
<BrowserRouter>
<Admin basename="/admin" dataProvider={...}>
<Admin basename="/admin" dataProvider={dataProvider}>
<Resource name="posts" />
</Admin>
</BrowserRouter>
Expand Down Expand Up @@ -955,9 +959,11 @@ React-admin will have to prefix all the internal links with `/admin`. Use the `<
```tsx
// in src/StoreAdmin.js
import { Admin, Resource } from 'react-admin';
import { dataProvider } from './dataProvider';
import posts from './posts';

export const StoreAdmin = () => (
<Admin basename="/admin" dataProvider={...}>
<Admin basename="/admin" dataProvider={dataProvider}>
<Resource name="posts" {...posts} />
</Admin>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/DataProviderWriting.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ interface DeleteParams {
interface DeleteResult {
data: Record;
}
function delete(resource: string, params: DeleteParams): Promise<DeleteResult>
function _delete(resource: string, params: DeleteParams): Promise<DeleteResult>
```

**Example**
Expand Down

0 comments on commit 802bab4

Please sign in to comment.