(credentialId?: string, enabled = true)
| 76 | } |
| 77 | |
| 78 | export function useWorkspaceCredential(credentialId?: string, enabled = true) { |
| 79 | return useQuery<WorkspaceCredential | null>({ |
| 80 | queryKey: workspaceCredentialKeys.detail(credentialId), |
| 81 | queryFn: async ({ signal }) => { |
| 82 | if (!credentialId) return null |
| 83 | const data = await requestJson(getWorkspaceCredentialContract, { |
| 84 | params: { id: credentialId }, |
| 85 | signal, |
| 86 | }) |
| 87 | return data.credential ?? null |
| 88 | }, |
| 89 | enabled: Boolean(credentialId) && enabled, |
| 90 | staleTime: 60 * 1000, |
| 91 | }) |
| 92 | } |
| 93 | |
| 94 | export function useCreateCredentialDraft() { |
| 95 | return useMutation({ |
no test coverage detected