mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 14:27:30 +00:00
refactor: Consolidate project ID retrieval in PolicySelectionModal and RolePermissionsSection for improved clarity and consistency
This commit is contained in:
+2
-2
@@ -47,9 +47,9 @@ type TForm = { permissions: Record<ProjectPermissionSub, boolean> };
|
|||||||
const Content = ({ onClose, type: projectType }: ContentProps) => {
|
const Content = ({ onClose, type: projectType }: ContentProps) => {
|
||||||
const rootForm = useFormContext<TFormSchema>();
|
const rootForm = useFormContext<TFormSchema>();
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const { currentProject } = useProject();
|
const { currentProject, projectId } = useProject();
|
||||||
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
|
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
|
||||||
const { data: integrations = [] } = useGetWorkspaceIntegrations(currentProject?.id ?? "", {
|
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, {
|
||||||
enabled: isSecretManagerProject,
|
enabled: isSecretManagerProject,
|
||||||
refetchInterval: false
|
refetchInterval: false
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-6
@@ -103,14 +103,11 @@ export const renderConditionalComponents = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
|
export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
|
||||||
const { currentProject } = useProject();
|
const { currentProject, projectId } = useProject();
|
||||||
const projectId = currentProject?.id || "";
|
|
||||||
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
|
const isSecretManagerProject = currentProject.type === ProjectType.SecretManager;
|
||||||
|
|
||||||
const { data: role, isPending } = useGetProjectRoleBySlug(
|
const { data: role, isPending } = useGetProjectRoleBySlug(projectId, roleSlug as string);
|
||||||
currentProject?.id ?? "",
|
|
||||||
roleSlug as string
|
|
||||||
);
|
|
||||||
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, {
|
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, {
|
||||||
enabled: isSecretManagerProject,
|
enabled: isSecretManagerProject,
|
||||||
refetchInterval: false
|
refetchInterval: false
|
||||||
|
|||||||
Reference in New Issue
Block a user