mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
* Handle landing on a bucket id that doesnt exist in project * Standardize re routing behaviour for files bucket * refactor --------- Co-authored-by: Alaister Young <a@alaisteryoung.com>
16 lines
329 B
TypeScript
16 lines
329 B
TypeScript
import { useParams } from 'common'
|
|
import { useBucketsQuery } from 'data/storage/buckets-query'
|
|
|
|
export const useSelectedBucket = () => {
|
|
const { ref, bucketId } = useParams()
|
|
|
|
return useBucketsQuery(
|
|
{ projectRef: ref },
|
|
{
|
|
select(data) {
|
|
return data.find((b) => b.id === bucketId)
|
|
},
|
|
}
|
|
)
|
|
}
|