Skip to content

Commit

Permalink
use getValueFromInput
Browse files Browse the repository at this point in the history
  • Loading branch information
gally47 committed Jul 8, 2024
1 parent 69a693c commit 1527192
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import styled from 'styled-components';

import { Alert, Input, Row, Col } from 'components/bootstrap';
import { SearchForm, Spinner } from 'components/common';
import { getValueFromInput } from 'util/FormsUtils';

import type { RemoteReindexRequest } from '../../hooks/useRemoteReindexMigrationStatus';
import type { MigrationActions, MigrationState, MigrationStepComponentProps, StepArgs } from '../../Types';
Expand Down Expand Up @@ -94,10 +95,10 @@ const MigrateExistingData = ({ currentStep, onTriggerStep }: MigrationStepCompon

const handleChange = async (e: React.ChangeEvent<any>, callback: (field: string, value: any, shouldValidate?: boolean) => Promise<void | FormikErrors<RemoteReindexRequest>>) => {
let value;
value = e.target.value;
value = getValueFromInput(e.target);

if (e.target.name === 'threads') {
value = Number(e.target.value) < 1 ? DEFAULT_THREADS_COUNT : Number(e.target.value);
value = (value || 0) < 1 ? DEFAULT_THREADS_COUNT : value;
}

await callback(e.target.name, value);
Expand Down

0 comments on commit 1527192

Please sign in to comment.