export const Link = ({ to, children, ...props }: any) => (
  <a href={typeof to === 'string' ? to : '#'} {...props}>
    {children}
  </a>
);

export const request = (url: string, options: any) => {
  return fetch(url, options)
    .then((res) => {
      if (!res.ok) {
        throw new Error(res.statusText);
      }
      return res;
    })
    .then((res) => res.json());
};

export { useNavigate, useParams, useSearchParams } from 'react-router-dom';
export const history = window.history;
