Skip to content

Commit af19930

Browse files
authored
Fix AdminBuilder override example
1 parent 0734d66 commit af19930

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

admin/getting-started.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,32 +199,30 @@ Platform Admin. This is particularly useful to add custom validation rules:
199199

200200
```javascript
201201
import React, { Component } from 'react';
202-
import { AdminBuilder, hydraClient } from 'api-platform-admin';
203-
import parseHydraDocumentation from 'api-doc-parser/lib/hydra/parseHydraDocumentation';
202+
import { AdminBuilder, hydraClient } from '@api-platform-admin';
203+
import parseHydraDocumentation from '@api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation';
204204

205205
const entrypoint = 'https://demo.api-platform.com';
206206

207207
export default class extends Component {
208-
state = {api: null};
208+
state = { api: null };
209209

210210
componentDidMount() {
211-
parseHydraDocumentation(entrypoint).then( ({ api }) => => {
211+
parseHydraDocumentation(entrypoint).then( ({ api }) => {
212212
const books = api.resources.find(r => 'books' === r.name);
213213

214214
books.writableFields.find(f => 'description' === f.name).inputProps = {
215215
validate: value => value.length >= 30 ? undefined : 'Minimum length: 30';
216216
};
217217

218-
this.setState({api: api});
219-
220-
return { api };
218+
this.setState({ api });
221219
});
222220
}
223221

224222
render() {
225223
if (null === this.state.api) return <div>Loading...</div>;
226224

227-
return <AdminBuilder api={this.state.api} dataProvider={hydraClient(entrypoint)}/>
225+
return <AdminBuilder api={ this.state.api } dataProvider={ hydraClient(this.state.api) }/>
228226
}
229227
}
230228
```

0 commit comments

Comments
 (0)