MCPcopy Index your code
hub / github.com/simstudioai/sim / useAllowedIntegrationsFromEnv

Function useAllowedIntegrationsFromEnv

apps/sim/hooks/use-permission-config.ts:40–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40function useAllowedIntegrationsFromEnv() {
41 return useQuery<AllowedIntegrationsResponse>({
42 queryKey: allowedIntegrationsKeys.env(),
43 queryFn: async ({ signal }) => {
44 try {
45 return await requestJson(getAllowedIntegrationsContract, { signal })
46 } catch (error) {
47 // Treat any auth/server failure as "no env allowlist configured"
48 // so the UI falls back to the permission-group-driven allowlist.
49 if (error instanceof ApiClientError) {
50 return { allowedIntegrations: null }
51 }
52 throw error
53 }
54 },
55 staleTime: 5 * 60 * 1000,
56 })
57}
58
59/**
60 * Intersects two allowlists. If either is null (unrestricted), returns the other.

Callers 1

usePermissionConfigFunction · 0.85

Calls 1

requestJsonFunction · 0.90

Tested by

no test coverage detected