How to use the antd.notification.error function in antd

To help you get started, we’ve selected a few antd 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 ckinmind / mobx-share / src / page-mobx / p9.js View on Github external
this.disposer = intercept(this.style, 'color', change => {

            if (!change.newValue) {
                // 忽略取消设置背景颜色
                notification.error({message: '错误提示', description: '颜色值不能为空'});
                return null;
            }
            if (change.newValue.length === 6) {
                // 补全缺少的 '#' 前缀
                change.newValue = '#' + change.newValue;
                notification.warn({message: '警告提示', description: '缺少#前缀'});
                return change;
            }
            if (change.newValue.length === 7) {
                return change;
            }
            if (change.newValue.length > 10) this.disposer(); // 不再拦截今后的任何变化
            notification.error({message: '错误提示', description: change.newValue + ' 不是一个合法的颜色值'});
        });
github electerm / electerm / src / client / common / fetch.js View on Github external
export async function handleErr (res) {
  log.debug(res)
  let text = res.message || res.statusText
  if (!_.isString(text)) {
    try {
      text = _.isFunction(res.text)
        ? await res.text()
        : _.isFunction(res.json) ? await res.json() : ''
    } catch (e) {
      log.error('fetch response parse fails', e)
    }
  }
  log.debug(text, 'fetch err info')
  notification.error({
    message: 'error',
    description: (
      <div>
        {text}
      </div>
    ),
    duration: 55
  })
}
github amrkhaledccd / my-moments / instagram-clone-client / src / user / login / Login.js View on Github external
.catch(error => {
            if (error.status === 401) {
              notification.error({
                message: "MyMoments",
                description:
                  "Username or Password is incorrect. Please try again!"
              });
            } else {
              notification.error({
                message: "MyMoments",
                description:
                  error.message ||
                  "Sorry! Something went wrong. Please try again!"
              });
            }
          });
      }
github Fndroid / clash-config-builder / src / App.js View on Github external
resps.forEach((data, index) => {
        if (data === "") {
          notification.error({
            message: "Could not download from subscription",
            description: urls[index]
          })
          return
        }
        let yml = {}
        try {
          yml = ymlParse(data)
        } catch{ }
        const { 'Proxy': p = [] } = yml
        proxies = proxies.concat(p)
      })
      setSubProxies(proxies)
github XiaoMi / thain / thain-fe / src / utils / request.ts View on Github external
const errorHandler = (error: ResponseError) => {
  const { response = {} as Response } = error;
  const errortext = codeMessage[response.status] || response.statusText;
  const { status, url } = response;

  notification.error({
    message: `请求错误 ${status}: ${url}`,
    description: errortext,
  });
};
github goodrain / rainbond-ui / src / components / TcpTable / index.js View on Github external
callback: data => {
          data
            ? notification.success({ message: data.msg_show || "编辑成功" })
            : notification.error({ message: "编辑失败" });
          this.setState({
            TcpDrawerVisible: false,
            editInfo: false
          });
          this.load();
        }
      });
github fluidtrends / carmel / chunks / tokens / components / claimContinue.js View on Github external
onItemEdit (item) {
    const value = this.state[item.id] === null ? null : (this.state[item.id] || this.props.account[item.id])
    if (!value) {
      notification.error({
        message: 'Missing username',
        description: `${'Add your username before moving on to the next step'}`
      })
      return
    }

    this.props.onClaimAction &&
      this.props.onClaimAction(item, { [item.id]: value })
  }
github bonustrack / steemconnect / src / components / Apps / AppForm.js View on Github external
.then((result) => {
        this.handleCancel();
        if (result.success) {
          notification.success({
            message: intl.formatMessage({ id: 'success' }),
            description: intl.formatMessage({ id: 'success_revoke_app_tokens' }),
          });
        } else {
          notification.error({
            message: intl.formatMessage({ id: 'error' }),
            description: intl.formatMessage({ id: 'general_error_short' }),
          });
        }
      });
  }
github SolidZORO / leaa / packages / leaa-dashboard / src / utils / setting.util.ts View on Github external
const getSetting = (params: { key: string; disableNotification?: boolean }): ISetting => {
  const settingByEerrorTips: ISetting = {
    name: '',
    slug: '',
    value: '',
  };
  const settingsByEmpty: ISetting[] = [settingByEerrorTips];
  const settingsByLs = localStorage.getItem('settings');
  const settings = settingsByLs ? (JSON.parse(settingsByLs) as ISetting[]) : settingsByEmpty;

  const setting = settings.find(t => t.slug === params.key);

  if (!setting) {
    if (!params.disableNotification) {
      notification.error({ message: `setting  ${params.key} not  found` });
    }

    return settingByEerrorTips;
  }

  return setting;
};
github jamaljsr / polar / src / store / models / app.ts View on Github external
notify: action((state, { message, description, error }) => {
    const options = {
      placement: 'bottomRight',
      bottom: 50,
    } as ArgsProps;
    if (!error) {
      notification.success({
        ...options,
        message: message,
        description,
      });
    } else {
      notification.error({
        ...options,
        duration: 10,
        message: message,
        description: description || error.message,
      });
    }
  }),
  navigateTo: thunk((actions, route, { dispatch }) => {