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