mirror of
https://github.com/supabase/supabase.git
synced 2026-06-14 05:06:27 +08:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
20 lines
573 B
TypeScript
20 lines
573 B
TypeScript
import { useParams } from 'common'
|
|
|
|
import { useIsAnalyticsBucketsEnabled } from '@/data/config/project-storage-config-query'
|
|
import { useAnalyticsBucketsQuery } from '@/data/storage/analytics-buckets-query'
|
|
|
|
export const useSelectedAnalyticsBucket = () => {
|
|
const { ref, bucketId } = useParams()
|
|
const hasIcebergEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref })
|
|
|
|
return useAnalyticsBucketsQuery(
|
|
{ projectRef: ref },
|
|
{
|
|
enabled: hasIcebergEnabled,
|
|
select(data) {
|
|
return data.find((x) => x.name === bucketId)
|
|
},
|
|
}
|
|
)
|
|
}
|