import { useState } from "react"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; import { Checkbox } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context"; import { useUpdateProject } from "@app/hooks/api/projects/queries"; export const SecretSnapshotsLegacySection = () => { const { currentProject } = useProject(); const { mutateAsync: updateProject } = useUpdateProject(); const [isLoading, setIsLoading] = useState(false); const handleToggle = async (state: boolean) => { setIsLoading(true); try { if (!currentProject?.id) { setIsLoading(false); return; } await updateProject({ projectId: currentProject.id, showSnapshotsLegacy: state }); createNotification({ text: `Successfully ${state ? "enabled" : "disabled"} secret snapshots legacy for this project`, type: "success" }); } catch (err) { console.error(err); createNotification({ text: "Failed to update secret snapshots legacy for this project", type: "error" }); } finally { setIsLoading(false); } }; return (
Show Secret Snapshots ( legacy )