refactor: Consolidate project ID retrieval in PolicySelectionModal and RolePermissionsSection for improved clarity and consistency

This commit is contained in:
Victor Santos
2025-12-03 16:25:27 -03:00
parent 935d400a97
commit 8f3e5a8362
2 changed files with 5 additions and 8 deletions

View File

@@ -47,9 +47,9 @@ type TForm = { permissions: Record<ProjectPermissionSub, boolean> };
const Content = ({ onClose, type: projectType }: ContentProps) => {
const rootForm = useFormContext<TFormSchema>();
const [search, setSearch] = useState("");
const { currentProject } = useProject();
const { currentProject, projectId } = useProject();
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
const { data: integrations = [] } = useGetWorkspaceIntegrations(currentProject?.id ?? "", {
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, {
enabled: isSecretManagerProject,
refetchInterval: false
});

View File

@@ -103,14 +103,11 @@ export const renderConditionalComponents = (
};
export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
const { currentProject } = useProject();
const projectId = currentProject?.id || "";
const { currentProject, projectId } = useProject();
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
const { data: role, isPending } = useGetProjectRoleBySlug(
currentProject?.id ?? "",
roleSlug as string
);
const { data: role, isPending } = useGetProjectRoleBySlug(projectId, roleSlug as string);
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, {
enabled: isSecretManagerProject,
refetchInterval: false