mirror of
https://github.com/supabase/supabase.git
synced 2026-07-07 10:30:22 +08:00
19 lines
568 B
TypeScript
19 lines
568 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)
|
|
},
|
|
}
|
|
)
|
|
}
|