feat: add useActions with RQ
This commit is contained in:
@@ -15,6 +15,7 @@ import { EditorContext } from 'contexts/Editor';
|
||||
import FlowSubstepTitle from 'components/FlowSubstepTitle';
|
||||
import { StepPropType, SubstepPropType } from 'propTypes/propTypes';
|
||||
import useTriggers from 'hooks/useTriggers';
|
||||
import useActions from 'hooks/useActions';
|
||||
|
||||
const optionGenerator = (app) => ({
|
||||
label: app.name,
|
||||
@@ -56,12 +57,14 @@ function ChooseAppAndEventSubstep(props) {
|
||||
|
||||
const { data: triggers } = useTriggers(app?.key);
|
||||
|
||||
const { data: actions } = useActions(app?.key);
|
||||
|
||||
const appOptions = React.useMemo(
|
||||
() => apps?.data?.map((app) => optionGenerator(app)) || [],
|
||||
[apps?.data],
|
||||
);
|
||||
|
||||
const actionsOrTriggers = (isTrigger ? triggers?.data : app?.actions) || [];
|
||||
const actionsOrTriggers = (isTrigger ? triggers?.data : actions?.data) || [];
|
||||
|
||||
const actionOrTriggerOptions = React.useMemo(
|
||||
() => actionsOrTriggers.map((trigger) => eventOptionGenerator(trigger)),
|
||||
|
Reference in New Issue
Block a user