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 watertao / teemo / src / utils / rest-err-processor.js View on Github external
function process_401(e, path) {
  const { extra, request } = e;
  const { options: { method } } = request;

  // GET /system/session
  // no notify , but redirect to /login
  if (method == SESSION_SYNC_REQ.verb && _.startsWith(path, SESSION_SYNC_REQ.uri)) {
    router.push('/login');
  }

  // POST /system/session
  // notify, but don't redirect to /login
  else if (method == SESSION_CREATE_REQ.verb && _.startsWith(path, SESSION_CREATE_REQ.uri)) {
    notifyError(
      extra.statusText,
      extra.status,
      request.url,
      extra.data? extra.data.message : extra.statusText,
      method,
    );
  }

  // other requests
  // notify, and redirect to /login
github DFocusGroup / generator-umi / generators / app / templates / src / helpers / view.js View on Github external
export function redirectTo(to, from) {
  if (isString(to) || isString(from)) {
    if (!from) {
      return router.push(to)
    }
    return router.push({
      pathname: to,
      query: {
        from
      }
    })
  }
  // to为完整的RouteData
  return router.push(to)
}
github trueai-org / module-shop-admin / src / pages / Sale / Order / Add.js View on Github external
}, () => {
                        if (res.success === true) {
                            router.push('./list');
                        } else {
                            notification.error({ message: res.message, });
                        }
                    });
                });
github umijs / umi / examples / with-redux / pages / index.js View on Github external
gotoExtInfoPage = () => {
    router.push({
      pathname: '/extinfo',
      query: { id: 123 },
    });
  };
github mojisrc / fashop-admin / src / components / shipper / list / table / index.js View on Github external
onClick={() => {
                            router.push({
                                pathname: `/setting/deliver/shipper/edit`,
                                search: `?id=${record.id}`
                            });
                        }}
                    >
github crawlab-team / artipub / src / pages / 404.tsx View on Github external
      <button type="primary"> router.push('/')}&gt;
        Back Home</button>
github chillzhuang / Sword / src / pages / Desk / Notice / NoticeView.js View on Github external
handleEdit = () => {
    const {
      match: {
        params: { id },
      },
    } = this.props;
    router.push(`/desk/notice/edit/${id}`);
  };
github trueai-org / module-shop-admin / src / pages / Content / Widget / WidgetCarousel.js View on Github external
}).then(res => {
                    this.setState({ submitting: false });
                    if (res.success === true) {
                        router.push('./list');
                    } else {
                        notification.error({ message: res.message, });
                    }
                });
            }
github chillzhuang / Sword / src / pages / System / Tenant / TenantView.js View on Github external
handleEdit = () => {
    const {
      match: {
        params: { id },
      },
    } = this.props;
    router.push(`/system/tenant/edit/${id}`);
  };