EditorsLayout.hooks.ts 359 B

12345678910111213
  1. import { useParams } from 'common'
  2. import { usePathname } from 'next/navigation'
  3. export function useEditorType(): 'table' | 'sql' | undefined {
  4. const pathname = usePathname()
  5. const { ref } = useParams()
  6. return pathname?.includes(`/project/${ref}/editor`)
  7. ? 'table'
  8. : pathname?.includes(`/project/${ref}/sql`)
  9. ? 'sql'
  10. : undefined
  11. }