当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript toastr.success方法代码示例

本文整理汇总了TypeScript中react-redux-toastr.toastr.success方法的典型用法代码示例。如果您正苦于以下问题:TypeScript toastr.success方法的具体用法?TypeScript toastr.success怎么用?TypeScript toastr.success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在react-redux-toastr.toastr的用法示例。


在下文中一共展示了toastr.success方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: checkMembershipWorker

// ------------------------------------
// Check membership
// ------------------------------------
function* checkMembershipWorker(action) {
  const {Dao1901Members} = contracts
  try {
    const {memberAddressToCheck} = action.values
    let isMember = yield call(Dao1901Members.isMember, memberAddressToCheck)
    if (isMember) {
      toastr.success('Membership management', `${memberAddressToCheck} is a member`)
    } else {
      toastr.error('Membership management', `${memberAddressToCheck} is not a member`)
    }
    yield put({type: 'CHECK_MEMBERSHIP_SUCCEED', values: {isMember}})
  } catch (e) {
    yield put({type: 'CHECK_MEMBERSHIP_FAILED', error: e.message})
  }
}
开发者ID:asseth,项目名称:dao1901,代码行数:18,代码来源:daoSaga.ts

示例2: test

function test() {
    const store = createStore(combineReducers({ toastr: toastrReducer }));
    var toastrFactory = React.createFactory(ReduxToastr);
    var element = toastrFactory({ timeOut: 1000, newestOnTop: false });
    var providerFactory = React.createFactory(Provider);
    var root = providerFactory({ store: store }, element);

    function callback() { }

    toastr.clean();
    toastr.confirm("Test", { onOk: callback, onCancel: callback });
    toastr.error("Error", "Error message");
    toastr.info("Info", "Info test", { timeOut: 1000, removeOnHover: true, onShowComplete: callback });
    toastr.success("Test", "Test message", { component: new React.Component({}) });
}
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:15,代码来源:react-redux-toastr-tests.ts

示例3: toastrManager

export default function toastrManager(nextProps, props) {
  let newErrorsLength = nextProps.errors.length
  let newTxsLength = nextProps.txs.length

  // Checking if new tx and show a toast message
  if (newTxsLength > 0 && newTxsLength !== props.txs.length) {
    let message, title
    switch (nextProps.txs[newTxsLength - 1].event) {
      case 'TX_ADD_MEMBER_SUCCEED':
        message = `The member ${nextProps.members[nextProps.members.length - 1].memberAddress} has been added successfully`
        title = 'Membership management'
        break
      case 'TX_REVOKE_MEMBER_SUCCEED':
        message = `The member has been revoked successfully`
        title = 'Membership management'
        break
      case 'TX_CREATE_PROPOSAL_SUCCEED':
        message = 'Your proposal has been successfully submitted'
        title = 'Proposal submission'
        break
      case 'TX_VOTE_SUBMISSION_SUCCEED':
        message = 'Your vote has been successfully submitted'
        title = 'Voting'
        break
      case 'TX_TRANSFER_OWNERSHIP_SUCCEED':
        message = `The ownership has been transferred to ${nextProps.ownerAddress}`
        title = 'Organization management'
        break
      default:
        throw new Error('Unknown event')
    }
    toastr.success(title, `${message} - Transaction ID: ${nextProps.txs[newTxsLength - 1].tx}`)
  }
  // Checking if new error and show a toast message
  if (newErrorsLength > 0 && newErrorsLength !== props.errors.length) {
    let message, title
    switch (nextProps.errors[newErrorsLength - 1].event) {
      case 'TX_ADD_MEMBER_FAILED':
        message = `The member ${nextProps.members[nextProps.members.length - 1].memberAddress} has not been added. Please try later`
        title = 'Error'
        break
      case 'TX_REVOKE_MEMBER_FAILED':
        message = `The member has not been revoked successfully. Please try later`
        title = 'Error'
        break
      case 'TX_CREATE_PROPOSAL_FAILED':
        message = 'An error occurred. Please try later or contact the support'
        title = 'Error'
        break
      case 'TX_VOTE_SUBMISSION_FAILED':
        message = `An error occurred. Please try later or contact the support. ` +
          `Hint: Check that the proposal id is valid and that you are registered as member`
        title = 'Error'
        break
      case 'TX_TRANSFER_OWNERSHIP_FAILED':
        message = 'You don\'t have the rights to transfer ownership'
        title = 'Error'
        break
      default:
        throw new Error('Unknown event')
    }
    toastr.error(title, message)
  }
}
开发者ID:asseth,项目名称:dao1901,代码行数:64,代码来源:toastrManager.ts

示例4: dispatch

 DataSource.students.update(editedStudent).then(updatedStudent => {
     dispatch(commonActionCreators.finishTalkingToTheServer());
     hashHistory.push('/students');
     toastr.success('Student updated');
 });
开发者ID:danilobjr,项目名称:crud-react-redux-ts,代码行数:5,代码来源:actions.ts


注:本文中的react-redux-toastr.toastr.success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。