From 9c7ba51d1090780ce3c8de7e5d98bdefb18a227b Mon Sep 17 00:00:00 2001 From: Evgenii Fedoseev Date: Wed, 28 Feb 2024 20:18:12 +0300 Subject: [PATCH] fix: swap send button with response section and refactor --- src/runtime/components/BodyFormData.tsx | 2 +- src/runtime/components/FileInputArray.tsx | 8 ++++---- src/runtime/sandbox.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/components/BodyFormData.tsx b/src/runtime/components/BodyFormData.tsx index a4ecd04..505f386 100644 --- a/src/runtime/components/BodyFormData.tsx +++ b/src/runtime/components/BodyFormData.tsx @@ -1,9 +1,9 @@ import React from 'react'; import {Text, TextArea} from '@gravity-ui/uikit'; +import {JSONSchema6Definition} from 'json-schema'; import {Text as TextEnum} from '../../plugin/constants'; import {OpenJSONSchema} from '../../includer/models'; -import { JSONSchema6Definition } from 'json-schema'; import type {Field, Nullable} from '../types'; import {Column} from './Column'; diff --git a/src/runtime/components/FileInputArray.tsx b/src/runtime/components/FileInputArray.tsx index bd27c18..9dfd027 100644 --- a/src/runtime/components/FileInputArray.tsx +++ b/src/runtime/components/FileInputArray.tsx @@ -20,7 +20,7 @@ export const FileInputArray: React.FC = ({onChange}) => { setInputs((oldState) => { const file = event.target.files?.[0]; const nextState = {...oldState, [idWithChange]: file } - + onChange(Object.values(nextState).filter(isFile)); return nextState; @@ -35,10 +35,10 @@ export const FileInputArray: React.FC = ({onChange}) => { const createOnRemove = useCallback( (idForRemove: number) => () => { - setInputs((OldState) => { - delete OldState[idForRemove]; + setInputs((oldState) => { + delete oldState[idForRemove]; - return OldState; + return oldState; }); }, [setInputs], diff --git a/src/runtime/sandbox.tsx b/src/runtime/sandbox.tsx index 62f77f7..677bfae 100644 --- a/src/runtime/sandbox.tsx +++ b/src/runtime/sandbox.tsx @@ -67,12 +67,12 @@ export const Sandbox: React.FC = (props) => { example={props.body} bodyType={props.bodyType} /> - {request && }
+ {request && } );