2022-04-28 18:45:00 +00:00
|
|
|
import {
|
|
|
|
ActionTypes,
|
|
|
|
ITriggerBlockAction,
|
|
|
|
ITriggerCancel,
|
|
|
|
ITriggerSubmitView,
|
|
|
|
ModalActions
|
|
|
|
} from '../../containers/UIKit/interfaces';
|
|
|
|
import Navigation from '../navigation/appNavigation';
|
|
|
|
import { triggerAction } from './actions';
|
|
|
|
|
2022-05-30 22:02:08 +00:00
|
|
|
export async function triggerSubmitView({ viewId, ...options }: ITriggerSubmitView) {
|
|
|
|
const result = await triggerAction({ type: ActionTypes.SUBMIT, viewId, ...options });
|
2022-04-28 18:45:00 +00:00
|
|
|
if (!result || ModalActions.CLOSE === result) {
|
|
|
|
Navigation.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-30 22:02:08 +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-28 18:45:00 +00:00
|
|
|
}
|