Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

265 B
Raw Blame
import { useRouter } from 'next/router'

export const useCurrentPath = () => {
  const router = useRouter()

  if (!router.isReady) {
    return ''
  }

  const pathWithQuery = router.asPath
  const currentPath = pathWithQuery.split('?')[0]

  return currentPath
}