fix(web): correct types

This commit is contained in:
Ali BARIN
2022-10-07 12:43:59 +02:00
committed by Faruk AYDIN
parent 050f392dd1
commit c958abdfcf
2 changed files with 7 additions and 7 deletions

View File

@@ -60,14 +60,14 @@ function ChooseAppAndEventSubstep(
() => apps?.map((app) => optionGenerator(app)),
[apps]
);
const actionsOrTriggers = isTrigger ? app?.triggers : app?.actions;
const actionsOrTriggers: Array<ITrigger | IAction> = (isTrigger ? app?.triggers : app?.actions) || [];
const actionOptions = React.useMemo(
() => actionsOrTriggers?.map((trigger) => optionGenerator(trigger)) ?? [],
() => actionsOrTriggers.map((trigger) => optionGenerator(trigger)),
[app?.key]
);
const selectedActionOrTrigger =
actionsOrTriggers?.find(
(actionOrTrigger) => actionOrTrigger.key === step?.key
actionsOrTriggers.find(
(actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key
);
const { name } = substep;

View File

@@ -13,7 +13,7 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import { yupResolver } from '@hookform/resolvers/yup';
import * as yup from 'yup';
import type { BaseSchema } from 'yup';
import type { IApp, IField, IStep, ISubstep } from '@automatisch/types';
import type { IApp, ITrigger, IAction, IStep, ISubstep } from '@automatisch/types';
import { EditorContext } from 'contexts/Editor';
import { StepExecutionsProvider } from 'contexts/StepExecutions';
@@ -139,10 +139,10 @@ export default function FlowStep(
const apps: IApp[] = data?.getApps;
const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey);
const actionsOrTriggers = isTrigger ? app?.triggers : app?.actions;
const actionsOrTriggers: Array<ITrigger | IAction> = (isTrigger ? app?.triggers : app?.actions) || [];
const substeps = React.useMemo(
() =>
actionsOrTriggers?.find(({ key }) => key === step.key)?.substeps || [],
actionsOrTriggers?.find(({ key }: ITrigger | IAction) => key === step.key)?.substeps || [],
[actionsOrTriggers, step?.key]
);