( providerId?: string, enabledOrOptions?: boolean | UseOAuthCredentialsOptions )
| 85 | } |
| 86 | |
| 87 | export function useOAuthCredentials( |
| 88 | providerId?: string, |
| 89 | enabledOrOptions?: boolean | UseOAuthCredentialsOptions |
| 90 | ) { |
| 91 | const { enabled, workspaceId, workflowId } = resolveOptions(enabledOrOptions) |
| 92 | |
| 93 | return useQuery<Credential[]>({ |
| 94 | queryKey: oauthCredentialKeys.list(providerId, workspaceId, workflowId), |
| 95 | queryFn: ({ signal }) => |
| 96 | fetchOAuthCredentials( |
| 97 | { |
| 98 | providerId: providerId ?? '', |
| 99 | workspaceId: workspaceId || undefined, |
| 100 | workflowId: workflowId || undefined, |
| 101 | }, |
| 102 | signal |
| 103 | ), |
| 104 | enabled: Boolean(providerId) && enabled, |
| 105 | staleTime: 60 * 1000, |
| 106 | }) |
| 107 | } |
| 108 | |
| 109 | export function useOAuthCredentialDetail( |
| 110 | credentialId?: string, |
no test coverage detected