diff --git a/client/src/components/InputsModal/InputAccess.tsx b/client/src/components/InputsModal/InputAccess.tsx index 0eebbf35d..6471c787f 100644 --- a/client/src/components/InputsModal/InputAccess.tsx +++ b/client/src/components/InputsModal/InputAccess.tsx @@ -22,17 +22,17 @@ const InputAccess: FC = ({ input, index, inputsMap, setInputsM const [accessValuesPopulated, setAccessValuesPopulated] = React.useState(false); // Default auth type settings - const authComponentDefault = input.options?.components?.find( + const authComponent = input.options?.components?.find( (component) => component.name === 'auth_type', - )?.default; + ); const firstListOption = - input.options?.list_options && input.options?.list_options?.length > 0 - ? input.options?.list_options[0] + authComponent?.options?.list_options && authComponent?.options?.list_options?.length > 0 + ? authComponent?.options?.list_options[0].value : undefined; const [authType, setAuthType] = React.useState( - (authComponentDefault || firstListOption || 'public') as string, + (authComponent?.default || firstListOption || 'public') as string, ); const [accessFields, setAccessFields] = React.useState( diff --git a/client/src/components/InputsModal/InputAuth.tsx b/client/src/components/InputsModal/InputAuth.tsx index bfa0bf95e..437b1739b 100644 --- a/client/src/components/InputsModal/InputAuth.tsx +++ b/client/src/components/InputsModal/InputAuth.tsx @@ -21,17 +21,17 @@ const InputAuth: FC = ({ input, index, inputsMap, setInputsMap } const [authValuesPopulated, setAuthValuesPopulated] = React.useState(false); // Default auth type settings - const authComponentDefault = input.options?.components?.find( + const authComponent = input.options?.components?.find( (component) => component.name === 'auth_type', - )?.default; + ); const firstListOption = - input.options?.list_options && input.options?.list_options?.length > 0 - ? input.options?.list_options[0] + authComponent?.options?.list_options && authComponent?.options?.list_options?.length > 0 + ? authComponent?.options?.list_options[0].value : undefined; const [authType, setAuthType] = React.useState( - (authComponentDefault || firstListOption || 'public') as string, + (authComponent?.default || firstListOption || 'public') as string, ); const [authFields, setAuthFields] = React.useState(