change the custom value as initialValue

This commit is contained in:
Simone Taeggi 2022-09-08 08:57:33 +02:00
parent 79000ad133
commit c86c5a62bf

View File

@ -294,17 +294,13 @@ const ApiTokenCreateView = () => {
initialValues={{
name: apiToken?.name || '',
description: apiToken?.description || '',
type: apiToken?.type,
type: state.selectedActions.length > 0 && !apiToken?.type ? 'custom' : apiToken?.type,
lifespan: apiToken?.lifespan,
}}
enableReinitialize
onSubmit={(body, actions) => handleSubmit(body, actions)}
>
{({ errors, handleChange, isSubmitting, values }) => {
if (state.selectedActions.length > 0 && !values?.type) {
values.type = 'custom';
}
return (
<Form>
<HeaderLayout