How to use the @lskjs/utils/composeUrl function in @lskjs/utils

To help you get started, we’ve selected a few @lskjs/utils 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 lskjs / ux / packages / ui / src / Link / Link.jsx View on Github external
handleClick(e) {
    const { onClick, target, to, href, qs } = this.props;
    const { linkProvider, history } = this.context;
    if (isMiddleClickEvent(e)) {
      return;
    }

    if (onClick) onClick(e);
    if (e.defaultPrevented === true) return;
    if (isModifiedEvent(e) || !isLeftClickEvent(e)) return;
    const url = composeUrl({ url: to || href, qs });
    if (url == null) return;
    if (target === '_blank' || isAbsoluteUrl(url)) return;
    e.preventDefault();

    if (history) {
      history.push(url);
    } else if (linkProvider) {
      linkProvider.onClick(url, e);
    } else {
      console.error('Link without linkProvider (history)'); // eslint-disable-line no-console
      window.location = url;
    }
  }
github lskjs / ux / packages / ui / src / Link / Link.jsx View on Github external
render() {
    const { to, href, qs, children, ...props } = this.props;
    const url = composeUrl({ url: to || href, qs });
    return <a href="{url}">{children}</a>;
  }
}