import { connect } from 'herculex';
import { getIn } from 'herculex/dist/utils/manipulate';

Component(connect({
  mapStateToProps: {},
})({
  data: {
    show: true,
  },
  didMount() {

  },
  methods: {
    onSubmit(e) {
      const formId = getIn(e, ['detail', 'formId'], '');
      this.commit('$global:updateState', { formId });
    },
    async onGetAuthorize() {
      this.dispatch('phoneTriggerFn');
      this.dispatch('closePhoneModal');
    },
    onCancel() {
      /* 失败 */
      this.dispatch('phoneTriggerFailFn');
      this.dispatch('closePhoneModal');
    },
    onAuthError() {
      /* 失败 */
      this.dispatch('phoneTriggerFailFn');
      this.dispatch('closePhoneModal');
    },
  },
}));
