Skip to content

Commit 6411aca

Browse files
refactor: Updates redirect url and adds default for status select
1 parent 8639231 commit 6411aca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/App.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ function App() {
1313
dataProvider={lb4Provider(process.env.REACT_APP_API_URL, httpClient)}
1414
authProvider={authProvider}
1515
>
16-
<Resource name='films'/>
1716
<Resource name='customers' list={CustomerList} />
1817
<Resource name='rentals' create={RentalCreate} list={RentalList} edit={RentalEdit}/>
19-
18+
<Resource name='films'/>
2019
</Admin>
2120
);
2221
}

src/components/RentalCreate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const RentalCreate = (props) => {
1515
const refresh = useRefresh();
1616
const redirect = useRedirect();
1717

18-
const onSuccess = () => {
18+
const onSuccess = ({data}) => {
1919
notify(`New Rental created `);
20-
redirect('/rentals');
20+
redirect(`/rentals?filter=%7B"id"%3A"${data.id}"%7D`);
2121
refresh();
2222
};
2323

@@ -58,6 +58,7 @@ const RentalCreate = (props) => {
5858
<SelectInput source='film_id' choices={films} />
5959
<SelectInput
6060
source='status'
61+
defaultValue='new'
6162
choices={[
6263
{ id: 'new', name: 'new' },
6364
{ id: 'paid', name: 'paid' },

0 commit comments

Comments
 (0)