Files
Gildas Garcia 7b37f0c774 feat(studio): update oauth apps mocks and UI to the latest API payloads formats (#53363)
## Description

Part of the work for OAuth apps with the scoped permissions. This PR:
- Update the mock data to the new format returned or expected by the
backend
- Remove unnecessary hooks that have their feature merged in another one
(`useOAuthOrgAppDetailsQuery` is now merged in
`useOAuthAppsPreflightValidationQuery`)

> [!NOTE]  
> At this stage, the UI still only use mock data

## Review instructions

If all tests pass, we're good.
2026-11-18 13:38:19 +01:00

30 lines
1.5 KiB
TypeScript

export const oauthAppsKeys = {
authorizeRequest: (id: string | undefined) => ['oauth-apps', 'authorize', id] as const,
authorizeOrganizations: (id: string | undefined) =>
['oauth-apps', 'authorize', id, 'organizations'] as const,
authorizeOrganizationProjects: (
slug: string | undefined | null,
params?: {
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
search?: string
statuses?: string[]
}
) => ['oauth-apps', 'authorize', 'organizations', slug, 'projects', params] as const,
preflightValidation: (slug: string | undefined, appId: string | undefined) =>
['oauth-apps', 'organizations', slug, 'apps', appId, 'preflight-validation'] as const,
// cursor omitted (rather than passed as `undefined`) so the cursor-less key is a true prefix
// of every paginated key — invalidating without a cursor clears every cached page.
approvals: (slug: string | undefined, cursor?: string) =>
cursor === undefined
? (['oauth-apps', 'approvals', slug] as const)
: (['oauth-apps', 'approvals', slug, cursor] as const),
appMemberGrants: (slug: string | undefined, appId: string | undefined, cursor?: string) =>
cursor === undefined
? (['oauth-apps', 'authorized', slug, appId, 'member-grants'] as const)
: (['oauth-apps', 'authorized', slug, appId, 'member-grants', cursor] as const),
grants: (cursor?: string) =>
cursor === undefined
? (['oauth-apps', 'grants'] as const)
: (['oauth-apps', 'grants', cursor] as const),
}