Unreleased bug: Fix inherited policy API call bug (#11412)

This commit is contained in:
RachelElysia 2023-04-28 10:52:16 -04:00 committed by GitHub
parent 56a1658579
commit 4fdf640820
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,10 +145,7 @@ const PolicyPage = ({
error: storedPolicyError,
} = useQuery<IStoredPolicyResponse, Error, IPolicy>(
["policy", policyId],
() =>
teamIdForApi
? teamPoliciesAPI.load(teamIdForApi, policyId as number)
: globalPoliciesAPI.load(policyId as number),
() => globalPoliciesAPI.load(policyId as number), // Note: Team members have access to policies through global API
{
enabled: isRouteOk && !!policyId, // Note: this justifies the number type assertions above
refetchOnWindowFocus: false,