diff --git a/frontend/src/components/settings/SettingsPage.jsx b/frontend/src/components/settings/SettingsPage.jsx index 79b5d21..9d1160b 100644 --- a/frontend/src/components/settings/SettingsPage.jsx +++ b/frontend/src/components/settings/SettingsPage.jsx @@ -8,6 +8,7 @@ import { revertFile, pullBranch, getDiff, + unlinkRepo, } from "../../api/api"; import SettingsModal from "./SettingsModal"; import SettingsBranchModal from "./SettingsBranchModal"; @@ -28,6 +29,7 @@ import { CheckCircle, File, Settings, + Unlink, } from "lucide-react"; import Alert from "../ui/Alert"; import CommitSection from "./CommitSection"; @@ -502,6 +504,27 @@ const SettingsPage = () => { } }; + const handleUnlinkRepo = async () => { + if (window.confirm("Are you sure you want to unlink this repository? This action cannot be undone.")) { + setLoadingAction("unlink_repo"); + try { + const response = await unlinkRepo(); + if (response.success) { + setSettings(null); + setStatus(null); + Alert.success("Repository unlinked successfully"); + } else { + Alert.error(response.error || "Failed to unlink repository"); + } + } catch (error) { + Alert.error("An unexpected error occurred while unlinking the repository"); + console.error("Error unlinking repository:", error); + } finally { + setLoadingAction(""); + } + } + }; + return (