How to use the antd-mobile/lib/toast.fail function in antd-mobile

To help you get started, we’ve selected a few antd-mobile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 1ibrary / 1ibrary-front-end / js / pages / Login.js View on Github external
get validatePassed() {

    // forbid gd
    if (this.state.school_id === 1) {
      Toast.fail('请输入正确的密码', 1)
      return false
    }

    if (this.state.school_id === -1) {
      Toast.offline('请选择你的学校噢~', 1)
      return false
    }

    if (!this.state.account) {
      Toast.offline('请输入学号噢~', 1)
      return false
    }

    if (!this.state.password) {
      Toast.offline('请输入密码噢~', 1)
      return false
github 1ibrary / 1ibrary-front-end / js / SplashScreen.js View on Github external
} = this.props.user

    setToken({
      uid,
      token,
      timestamp
    })

    this.props.dispatch(initApp())

    try {
      login(user.account, user.password, user.school_id)
      Actions[SCENE_INDEX]()
    } catch (e) {
      console.log(e)
      Toast.fail('自动登录失败', 1.5)
      Actions[SCENE_LOGIN]()
    }

    RNSplashScreen.hide()
  }
github 1ibrary / 1ibrary-front-end / js / pages / Home.js View on Github external
fetchHotBooks = async () => {
    let params = { page: 1 }

    let result
    try {
      result = (await HttpUtils.post(URL, params)) || {}
    } catch (e) {
      Toast.fail('加载失败', 1)
      this.setState({ isLoading: false })
      return
    }

    if (result.status !== 0) {
      return
    }

    this.setState({
      books: result.data,
      isLoading: false
    })
  }
github 1ibrary / 1ibrary-front-end / js / pages / profile / FeedBack.js View on Github external
}

    if (!content.trim()) {
      Toast.info('请输入您的反馈内容哦~', 1)
      return
    }

    let params = {
      content,
      contact
    }

    let response = (await HttpUtils.post(URL, params)) || {}

    if (response.status !== 0) {
      Toast.fail(response.msg, '1')
      return
    }

    Toast.success('反馈成功', 1, () => {
      Actions.pop()
    })
  }
github 1ibrary / 1ibrary-front-end / js / pages / Subscribe.js View on Github external
fetchSubscribeBooks = async () => {
    let result
    try {
      result = await HttpUtils.post(URL, {})
    } catch (e) {
      Toast.fail('加载失败', 1)
      this.setState({ isLoading: false })
      return
    }

    if (result.status !== 0) {
      return
    }

    this.setState({
      books: result.books,
      isLoading: false
    })
  }
github 1ibrary / 1ibrary-front-end / js / common / loading.js View on Github external
export default async function fetchData (func, success = '已加载最新数据', failed = '加载失败,请稍后重试') {
  Toast.loading('正在加载', 0)
  try {
    await func()
  } catch (e) {
    Toast.fail(failed, 1)
    return
  }
  Toast.success(success, 1)
}
github 1ibrary / 1ibrary-front-end / js / pages / search / SearchResult.js View on Github external
fetchBooks = async (index) => {
    Toast.loading('正在加载', 0)

    const params = {
      content: this.props.content,
      type: index
    }

    let response = (await HttpUtils.post(URL, params)) || {}

    if (response.status !== 0) {
      Toast.fail(response.msg, 1)
      return []
    }

    Toast.hide()

    return response.data
  }
github 1ibrary / 1ibrary-front-end / js / pages / book_collect / BookCollectList.js View on Github external
fetchList = async () => {
    const list_id = this.props.item.list_id
    const params = { list_id }
    const response = await HttpUtils.post(URL_SHOW, params)

    if (response.status !== 0) {
      Toast.fail('获取数据异常', 1)
      return
    }

    const data = response.data
    this.setState({ book_list: data })
  }
github 1ibrary / 1ibrary-front-end / js / pages / Login.js View on Github external
return
    }

    const {
      account,
      password
    } = this.state

    Toast.loading('正在登陆', 0)

    try {
      const response = await login(account, password, this.state.school_id)
      Toast.hide()
      Actions[SCENE_INDEX]({ user: response.data })
    } catch (e) {
      Toast.fail(e.message, 1)
      return
    }
  }