| 139 | }); |
| 140 | |
| 141 | export const oauthConsentsQueryOptions = () => ({ |
| 142 | queryKey: generateQueryKey(RequestKey.OAuthConsents), |
| 143 | queryFn: async (): Promise<OAuthConsentWithClient[]> => { |
| 144 | const consents = await getOAuthConsents(); |
| 145 | return Promise.all( |
| 146 | consents.map(async (consent) => { |
| 147 | try { |
| 148 | const client = await getOAuthPublicClient(consent.clientId); |
| 149 | return { ...consent, client, isClientDisabled: false }; |
| 150 | } catch (err) { |
| 151 | return { |
| 152 | ...consent, |
| 153 | client: null, |
| 154 | isClientDisabled: |
| 155 | err instanceof OAuthRequestError && err.status === 404, |
| 156 | }; |
| 157 | } |
| 158 | }), |
| 159 | ); |
| 160 | }, |
| 161 | staleTime: StaleTime.OneMinute, |
| 162 | }); |