import { useRouter } from 'next/router';

/**
 * Remove query parameters and fragment from Next router path to get just the pathname
 */
const useRouterPath = function useRouterPath() {
  const router = useRouter();
  const routerPath = router?.asPath;
  return new URL(routerPath || '', 'https://www.politico.com').pathname;
};
export default useRouterPath;