From ab4c65fadec140748b1cf38e85629a59bce0ab40 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 28 Nov 2023 14:48:37 +0100 Subject: [PATCH 1/2] [Doc] Fix snippets fails to render in JS --- docs/Admin.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/Admin.md b/docs/Admin.md index d77fa00494b..ca4e68d51fe 100644 --- a/docs/Admin.md +++ b/docs/Admin.md @@ -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' }; } }, @@ -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: { @@ -703,7 +705,7 @@ const queryClient = new QueryClient({ }); const App = () => ( - + ... ); @@ -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 = () => ( - + @@ -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 = () => ( - + @@ -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 = () => ( - + ); From 1cabb7addb01b96d3a3315f6d3e0d70dc3409e57 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 28 Nov 2023 15:03:44 +0100 Subject: [PATCH 2/2] Fix another instance --- docs/DataProviderWriting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/DataProviderWriting.md b/docs/DataProviderWriting.md index 79340427bf5..87d60314588 100644 --- a/docs/DataProviderWriting.md +++ b/docs/DataProviderWriting.md @@ -305,7 +305,7 @@ interface DeleteParams { interface DeleteResult { data: Record; } -function delete(resource: string, params: DeleteParams): Promise +function _delete(resource: string, params: DeleteParams): Promise ``` **Example**