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

[Doc] Fix snippets fails to render in JS #9478

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
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
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>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete is a reserved word, so there is no other way to make it compile

function _delete(resource: string, params: DeleteParams): Promise<DeleteResult>
```

**Example**
Expand Down
Loading