编辑后,我按照约定在列表上重定向。
但是,我需要在列表 URL 中提供其他参数。
有没有办法在 SimpleForm/Edit 上“作弊”来自定义重定向?
这是我的代码的相关部分:
const ProviderUserEditActions = ({ basePath, data }) => {
if (! data) return null
return (
<CardActions style={cardActionStyle}>
<ListButton basePath={basePath+'?'+queryString.stringify({providerId:data.providerId, providerName:data.providerName})} />
<RefreshButton />
</CardActions>
);
}
export const ProviderUserEdit = (props) => (
<Edit actions={<ProviderUserEditActions/>} title={<ProviderUserEditTitle />} {...props}>
{/*redirect=false will cause the loosing of the URL parameters :(
but this is the "least worst", because otherwise it would redirect to
'list' but without URL parameters it will completely crash...
we hope that someday we will be able to provide our own redirect
function
*/}
<SimpleForm redirect={false}>
<TextInput source="name" />
<TextInput source="email" />
<TextInput source="phone" />
<BooleanInput source="activated" />
</SimpleForm>
</Edit>
);