diff --git a/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx b/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx index 72f27ae87..b13259a0e 100644 --- a/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx +++ b/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx @@ -13,7 +13,6 @@ import RelatedFigureApi from '@app/api/streetcode/related-figure.api'; import TextsApi from '@app/api/streetcode/text-content/texts.api'; import useMobx from '@app/stores/root-store'; import PageBar from '@features/AdminPage/PageBar/PageBar.component'; -import { useAsync } from '@hooks/stateful/useAsync.hook'; import StreetcodeCoordinate from '@models/additional-content/coordinate.model'; import { ModelState } from '@models/enums/model-state'; import { RelatedFigureCreateUpdate, RelatedFigureUpdate } from '@models/streetcode/related-figure.model'; @@ -490,6 +489,7 @@ const NewStreetcode = () => { onChange={handleFieldChange} /> ; onChange: (fieldName: string, value: any) => void; + parseId: number } -const TextBlock = React.memo(({ inputInfo, setInputInfo, video, setVideo, onChange }: Props) => ( - -)); +const TextBlock = React.memo(({ + inputInfo, setInputInfo, video, setVideo, onChange, parseId, +}: Props) => { + const [inputInfoAsync, setInputInfoAsync] = useState>(); + useAsync(() => { + TextsApi.getByStreetcodeId(parseId).then((result) => { + setInputInfoAsync(result); + }); + }); + + useEffect(() => { + setInputInfo(inputInfoAsync); + }, [inputInfoAsync]); + + return ( + + ); +}); export default TextBlock;