Skip to content

Commit 69ccda6

Browse files
author
Nil20
committed
fix: use reusable func
1 parent 4a4878f commit 69ccda6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/client/src/v2-events/features/events/actions/quick-actions/useQuickActionModal.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
EventIndex,
2727
FieldConfig,
2828
FieldUpdateValue,
29+
getActionConfig,
2930
runFieldValidations
3031
} from '@opencrvs/commons/client'
3132
import { buttonMessages } from '@client/i18n/messages'
@@ -169,13 +170,6 @@ function QuickActionModal({
169170
)
170171
}
171172

172-
function getActionConfig(
173-
actionType: keyof typeof quickActions,
174-
eventConfiguration: EventConfig
175-
) {
176-
return eventConfiguration.actions.find((a) => a.type === actionType)
177-
}
178-
179173
export function useQuickActionModal(event: EventIndex) {
180174
const [quickActionModal, openModal] = useModal()
181175
const navigate = useNavigate()
@@ -189,7 +183,7 @@ export function useQuickActionModal(event: EventIndex) {
189183
) => {
190184
const config = quickActions[actionType]
191185
const label = actionLabels[actionType]
192-
const actionConfig = getActionConfig(actionType, eventConfiguration)
186+
const actionConfig = getActionConfig({ actionType, eventConfiguration })
193187
const { result } = await openModal<ModalResult>((close) => (
194188
<QuickActionModal
195189
close={close}

0 commit comments

Comments
 (0)