mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 00:39:49 +00:00
change the custom value as initialValue
This commit is contained in:
parent
79000ad133
commit
c86c5a62bf
@ -294,17 +294,13 @@ const ApiTokenCreateView = () => {
|
|||||||
initialValues={{
|
initialValues={{
|
||||||
name: apiToken?.name || '',
|
name: apiToken?.name || '',
|
||||||
description: apiToken?.description || '',
|
description: apiToken?.description || '',
|
||||||
type: apiToken?.type,
|
type: state.selectedActions.length > 0 && !apiToken?.type ? 'custom' : apiToken?.type,
|
||||||
lifespan: apiToken?.lifespan,
|
lifespan: apiToken?.lifespan,
|
||||||
}}
|
}}
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
onSubmit={(body, actions) => handleSubmit(body, actions)}
|
onSubmit={(body, actions) => handleSubmit(body, actions)}
|
||||||
>
|
>
|
||||||
{({ errors, handleChange, isSubmitting, values }) => {
|
{({ errors, handleChange, isSubmitting, values }) => {
|
||||||
if (state.selectedActions.length > 0 && !values?.type) {
|
|
||||||
values.type = 'custom';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<HeaderLayout
|
<HeaderLayout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user