I have a custom route:
<Route
exact
path="/assetsBulkCreate"
component={ComponentWithPermissions(AssetsBulkCreate)}
/>
It is used to create assets in bulk:
export const AssetsBulkCreate = ({permissions, ...props}) => {
return (
<Create
resource="assets/bulkInsert"
...
This works.
However, after we hit save the page is redirected to the Dashboard.
I would like to redirect it to the list
of the resource assets
(which is a different resource).
How can this be done?
P.S. The redirect
prop does not let us specify a different resource, so I cannot use list
as value there (it does not even work because the custom route does not have a list).
The redirect
prop also accept a function. See the documentation
For example:
const redirect = (basePath, id, data) => `/author/${data.author_id}/show`;
export const PostEdit = (props) => {
<Edit {...props}>
<SimpleForm redirect={redirect}>
...
</SimpleForm>
</Edit>
);