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


TypeScript toast.update方法代码示例

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


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

示例1: VerifiedAccount

function* VerifiedAccount(action: any): SagaIterator {
  const toastId = toast.info('Verifying account...', {
    className: 'toast',
  })

  try {
    const { token, password } = action.payload
    yield put(Actions.LoadingPage.onLoadingOn())

    const data = yield call(GetApiTokensFrost, token, password)
    yield put(Actions.VerifiedAccount.onVerifiedAccountSuccess())

    yield put(Actions.LoadingPage.onLoadingFull())
    yield put(Actions.SignOut.onSignOut({ redirectLogin: false }))
    yield put(Actions.SetTokenLogin.onSetTokenLogin(data))

    yield call(delay, 1000)

    browserHistory.push('/dashboard')

    toast.success('Your account has been verified!', {
      className: 'toast',
      autoClose: 2500,
    })
  } catch (e) {
    yield put(Actions.LoadingPage.onLoadingFull())
    yield put(Actions.VerifiedAccount.onVerifiedAccountError(e))
    yield call(delay, 300)
    yield put(Actions.VerifiedAccount.onVerifiedAccountClearError())

    if (e.includes('Email already verified')) {
      browserHistory.push('/dashboard')
      toast.info(e, {
        className: 'toast',
        autoClose: 2500,
      })
    } else if (e.includes('Expired token')) {
      const message = 'This link has expired. Please login and request a new validation email.'
      toast.update(toastId, {
        render: message,
        type: toast.TYPE.ERROR,
        className: 'toast',
        autoClose: false,
      })
    } else
      toast.update(toastId, {
        render: e,
        type: toast.TYPE.ERROR,
        autoClose: false,
        className: 'toast',
      })
  }
}
开发者ID:aconly,项目名称:frost-web,代码行数:53,代码来源:VerifiedAccount.saga.ts

示例2: toast

import { toast } from 'react-toastify';

const someToastId = toast('Testing!'); // $ExpectType string

// $ExpectType void
toast.update(someToastId, {
    render: "New Content",
    type: toast.TYPE.INFO
});
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:9,代码来源:react-toastify-tests.ts


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