How to use the umi.router.push function in umi

To help you get started, we’ve selected a few umi 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 hs-web / hsweb-ui-antd / 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;

  if (status === 401) {
    notification.error({
      message: '未登录或登录已过期,请重新登录。',
    });
    router.push('/user/login');
    return;
  } else {
    notification.error({
      message: `请求错误 ${status}: ${url}`,
      description: errortext,
    });
  }
};
github XiaoMi / thain / thain-fe / src / pages / Flow / List / FlowTable.tsx View on Github external
onClick={() => {
                router.push('/flow-editor/' + flow.id);
              }}
            >
github crawlab-team / artipub / src / pages / ArticleEdit / ArticleEdit.tsx View on Github external
const onBack = () => {
    router.push('/articles');

    TDAPP.onEvent('文章编辑-返回');
  };
github XiaoMi / thain / thain-fe / src / pages / FlowEditor / index.tsx View on Github external
saveCondition();

    const page = editor!.getCurrentPage();
    const nodes: EditorNode[] | undefined = page.save().nodes;
    const flowModel: FlowModel = { ...flowAttributes, id: flowId };
    if (nodes === undefined) {
      notification.error({ message: formatMessage({ id: 'flow.node.empty' }) });
      return;
    }
    const jobModelList: JobModel[] = nodes.map(node => JobModel.getInstance(node));
    if (dispatch) {
      const res = await addFlow({ flowModel, jobModelList });
      if (res === undefined) {
        return;
      }
      router.push('/flow/list');
      notification.success({ message: formatMessage({ id: 'flow.create.success' }) });
    }
  }
github XiaoMi / thain / thain-fe / src / pages / admin / AdminTabs.tsx View on Github external
onChange={activeKey => {
          if (activeKey === 'user') {
            router.push('/admin/user');
          } else {
            router.push('/admin/client');
          }
        }}
      >