How to use the ant-design-vue/es/notification.error function in ant-design-vue

To help you get started, we’ve selected a few ant-design-vue 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 chennqqi / godnslog / frontend / src / utils / request.js View on Github external
const errorHandler = (error) => {
  if (error.response) {
    const data = error.response.data
    // 从 localstorage 获取 token
    const token = storage.get(ACCESS_TOKEN)
    if (error.response.status === 403) {
      notification.error({
        message: 'Forbidden',
        description: data.message
      })
    }
    if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
      notification.error({
        message: 'Unauthorized',
        description: 'Authorization verification failed'
      })
      if (token) {
        store.dispatch('Logout').then(() => {
          setTimeout(() => {
            window.location.reload()
          }, 1500)
        })
      }
    }
  }
  return Promise.reject(error)
}
github pycook / cmdb / cmdb-ui / src / permission.js View on Github external
.catch((e) => {
        notification.error({
          message: e.message,
          description: 'Failed to request user information. Please try again!'
        })
        setTimeout(() => {
          console.log('should re-login')
          store.dispatch('Login')
        }, 3000)
      })
  } else if (to.path === '/user/login' && !config.useSSO && store.getters.roles.length !== 0) {
github pycook / cmdb / ui / src / permission.js View on Github external
.catch((e) => {
        console.log(e)
        notification.error({
          message: '错误',
          description: '请求用户信息失败,请重试'
        })
        setTimeout(() => {
          store.dispatch('Logout')
        }, 3000)
      })
  } else if (to.path === '/user/login' && !config.useSSO && store.getters.roles.length !== 0) {
github Sloaix / Gofi / gofi-frontend / src / utils / request.js View on Github external
const err = (error) => {
  console.log(error)
  if (error.response) {
    const data = error.response.data
    if (error.response.status === 403) {
      notification.error({
        message: 'Forbidden',
        description: data.message
      })
    }
    if (error.response.status === 401 &&
      !(data.result && data.result.isLogin)) {
      notification.error({
        message: 'Unauthorized',
        description: 'Authorization verification failed'
      })
    }
  } else {
    error = i18n.t('network.error')
  }
  return Promise.reject(error)
}
github Sloaix / Gofi / gofi-frontend / src / navigation-guards.js View on Github external
.catch((e) => {
        notification.error({
          message: '错误',
          description: e
        })
      })
  }