Skip to content

Commit

Permalink
simplify the map function
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Oct 4, 2023
1 parent 2b2b66c commit 8706c22
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions public/components/acceleration/selectors/index_type_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ export const IndexTypeSelector = ({
};
getJobId(query, http, (id: string) => {
pollQueryStatus(id, http, (data: any[]) => {
let dataTableFields: DataTableFieldsType[] = [];
if (data.length > 0)
dataTableFields = data.map((field, index) => ({
id: `${idPrefix}${index + 1}`,
fieldName: field.col_name,
dataType: field.data_type,
}));
const dataTableFields: DataTableFieldsType[] = data.map((field, index) => ({
id: `${idPrefix}${index + 1}`,
fieldName: field.col_name,
dataType: field.data_type,
}));
setAccelerationFormData({
...accelerationFormData,
dataTableFields: dataTableFields,
Expand Down

0 comments on commit 8706c22

Please sign in to comment.