import { connect } from 'herculex';
import { openNotify } from '../../../utils/doLogin';
import { NOTIFY_STATUS } from '../../../utils/const';
Component(connect({})({
  props: {},
  methods: {
    subscribeMessage(props) {
      const {
        success,
        enable = true
      } = props || {};

      if (!enable) {
        if (success) {
          success();
        }

        return;
      }

      openNotify.call(this).then(() => {
        my.setStorage({
          key: NOTIFY_STATUS,
          data: true
        });

        if (success) {
          success();
        }
      });
    }

  }
}));