Add API configuration

This commit is contained in:
Eric NGUYEN 2022-10-13 16:27:32 +02:00
parent 7a81bbaec6
commit e97720bc24
9 changed files with 23 additions and 4 deletions

View file

@ -19,6 +19,7 @@ import { IMessage } from '../../Interfaces/IMessage';
import { DISABLE_API } from '../../utils/default';
import { UseWorker, UseAsync } from './UseWorker';
import { FindContainerById } from '../../utils/itertools';
import { IAPIConfiguration } from '../../Interfaces/IAPIConfiguration';
export interface IUIProps {
selectedContainer: IContainerModel | undefined
@ -28,6 +29,7 @@ export interface IUIProps {
availableContainers: IAvailableContainer[]
availableSymbols: IAvailableSymbol[]
categories: ICategory[]
apiConfiguration: IAPIConfiguration | undefined
selectContainer: (containerId: string) => void
deleteContainer: (containerId: string) => void
onPropertyChange: (key: string, value: string | number | boolean | number[], type?: PropertyType) => void
@ -73,11 +75,13 @@ export function UI(props: IUIProps): JSX.Element {
if (window.Worker && !DISABLE_API) {
UseWorker(
props.current,
props.apiConfiguration?.apiGetFeedbackUrl,
setMessages
);
} else if (!DISABLE_API) {
UseAsync(
props.current,
props.apiConfiguration?.apiGetFeedbackUrl,
setMessages
);
}