mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Introduces UI for Scoped PAT's. ## Additional context WIP. Testing endpoints. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Scoped access tokens: create, view, delete, and manage granular resource/action permissions with custom expiry options and scoped creation flows. * New scoped token UI: modal/sheet creation flow, resource access selectors, permissions editor, and a scoped token list. * **UI Improvements** * Tabbed Classic vs Scoped tokens layout, refreshed tokens page, improved forms, search/filtering, and table tweaks. * **Bug Fixes / Maintenance** * New data hooks and utilities for scoped tokens and token handling. * **Removed** * Legacy account settings layout and legacy token banner. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
30 lines
806 B
TypeScript
30 lines
806 B
TypeScript
import { useMemo } from 'react'
|
|
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
|
|
import { useProjectsInfiniteQuery } from 'data/projects/projects-infinite-query'
|
|
|
|
interface UseOrgAndProjectDataOptions {
|
|
enabled?: boolean
|
|
}
|
|
|
|
export const useOrgAndProjectData = (options: UseOrgAndProjectDataOptions = {}) => {
|
|
const { enabled = true } = options
|
|
|
|
const { data: organizations = [], isLoading: isLoadingOrgs } = useOrganizationsQuery({ enabled })
|
|
|
|
const { data: projectsData, isLoading: isLoadingProjects } = useProjectsInfiniteQuery({
|
|
limit: 100,
|
|
})
|
|
|
|
const projects = useMemo(
|
|
() => projectsData?.pages.flatMap((page) => page.projects) ?? [],
|
|
[projectsData]
|
|
)
|
|
|
|
return {
|
|
organizations,
|
|
projects,
|
|
isLoadingOrgs,
|
|
isLoadingProjects,
|
|
}
|
|
}
|