fix: remove duplicate code

This commit is contained in:
Sérgio Salgado 2022-01-14 19:45:18 +00:00
parent 88637c4776
commit dc1f8f82f9
2 changed files with 8 additions and 7 deletions

View file

@ -75,10 +75,7 @@ const TriggerView = ({
error={error?.message}
save={add}
onClose={toggleWizard}
customInfoRequests={R.filter(
it => it.enabled === true,
customInfoRequests
)}
customInfoRequests={customInfoRequests}
/>
)}
{R.isEmpty(triggers) && (

View file

@ -48,8 +48,10 @@ const GET_CUSTOM_REQUESTS = gql`
const Triggers = () => {
const classes = useStyles()
const [wizardType, setWizard] = useState(false)
const { data, loading } = useQuery(GET_CONFIG)
const { data: customInfoReqData } = useQuery(GET_CUSTOM_REQUESTS)
const { data, loading: configLoading } = useQuery(GET_CONFIG)
const { data: customInfoReqData, loading: customInfoLoading } = useQuery(
GET_CUSTOM_REQUESTS
)
const [error, setError] = useState(null)
const [subMenu, setSubMenu] = useState(false)
@ -94,6 +96,8 @@ const Triggers = () => {
return setWizard(wizardName)
}
const loading = configLoading || customInfoLoading
return (
<>
<TitleSection
@ -178,7 +182,7 @@ const Triggers = () => {
showWizard={wizardType === 'newTrigger'}
config={data?.config ?? {}}
toggleWizard={toggleWizard('newTrigger')}
customInfoRequests={customInfoRequests}
customInfoRequests={enabledCustomInfoRequests}
/>
)}
{!loading && subMenu === 'advancedSettings' && (