Skip to content

Commit 741f3fe

Browse files
authoredJul 27, 2021
Merge pull request #6467 from WiXSL/docs-auth-sample
[Doc] Fix authentication examples
2 parents 6e14fc3 + b69f984 commit 741f3fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎docs/Authentication.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,14 @@ export const UserEdit = ({ permissions, ...props }) =>
10171017
What about the `List` view, the `Datagrid`, `SimpleList`? It works there, too. And in the next example, the `permissions` prop is passed down to a custom `filters` selector.
10181018

10191019
```jsx
1020+
import * as React from 'react';
1021+
import { List, Datagrid, ShowButton, TextField, TextInput } from 'react-admin';
1022+
10201023
const getUserFilters = (permissions) => ([
10211024
<TextInput label="user.list.search" source="q" alwaysOn />,
10221025
<TextInput source="name" />,
10231026
permissions === 'admin' ? <TextInput source="role" /> : null,
1024-
].filter(filter => filter !== null)));
1027+
].filter(filter => filter !== null));
10251028

10261029
export const UserList = ({ permissions, ...props }) =>
10271030
<List {...props} filters={getUserFilters(permissions)}>
@@ -1041,7 +1044,7 @@ React-admin injects the permissions into the component provided as a [`dashboard
10411044

10421045
```jsx
10431046
// in src/Dashboard.js
1044-
import * as React from "react";
1047+
import * as React from 'react';
10451048
import Card from '@material-ui/core/Card';
10461049
import CardContent from '@material-ui/core/CardContent';
10471050
import { Title } from 'react-admin';

0 commit comments

Comments
 (0)