2022-04-04 19:15:29 +00:00
|
|
|
import {
|
|
|
|
ActionTypes,
|
|
|
|
ITriggerBlockAction,
|
|
|
|
ITriggerCancel,
|
|
|
|
ITriggerSubmitView,
|
|
|
|
ModalActions
|
2022-04-07 16:53:07 +00:00
|
|
|
} from '../../containers/UIKit/interfaces';
|
|
|
|
import Navigation from '../navigation/appNavigation';
|
|
|
|
import { triggerAction } from './actions';
|
2022-04-04 19:15:29 +00:00
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
export async function triggerSubmitView({ viewId, ...options }: ITriggerSubmitView) {
|
|
|
|
const result = await triggerAction({ type: ActionTypes.SUBMIT, viewId, ...options });
|
2022-04-04 19:15:29 +00:00
|
|
|
if (!result || ModalActions.CLOSE === result) {
|
|
|
|
Navigation.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
export function triggerCancel({ view, ...options }: ITriggerCancel) {
|
|
|
|
return triggerAction({ type: ActionTypes.CLOSED, view, ...options });
|
|
|
|
}
|
|
|
|
|
|
|
|
export function triggerBlockAction(options: ITriggerBlockAction) {
|
|
|
|
return triggerAction({ type: ActionTypes.ACTION, ...options });
|
2022-04-04 19:15:29 +00:00
|
|
|
}
|