MCPcopy
hub / github.com/AstrBotDevs/AstrBot / uninstall

Function uninstall

dashboard/src/views/extension/useExtensionPage.js:573–608  ·  view source on GitHub ↗
(
    target,
    { deleteConfig = false, deleteData = false, skipConfirm = false } = {},
  )

Source from the content-addressed store, hash-verified

571 };
572
573 const uninstall = async (
574 target,
575 { deleteConfig = false, deleteData = false, skipConfirm = false } = {},
576 ) => {
577 if (!target?.id || !target?.kind) return;
578
579 if (!skipConfirm) {
580 requestUninstall(target);
581 return;
582 }
583
584 const isFailed = target.kind === "failed";
585 const options = {
586 delete_config: deleteConfig,
587 delete_data: deleteData,
588 };
589
590 toast(`${tm("messages.uninstalling")} ${target.id}`, "primary");
591
592 try {
593 const res = isFailed
594 ? await pluginApi.uninstallFailed(target.id, options)
595 : await pluginApi.uninstall(target.id, options);
596 if (res.data.status === "error") {
597 toast(res.data.message, "error");
598 return;
599 }
600 if (!isFailed) {
601 Object.assign(extension_data, res.data);
602 }
603 toast(res.data.message, "success");
604 await getExtensions();
605 } catch (err) {
606 toast(resolveErrorMessage(err, tm("messages.operationFailed")), "error");
607 }
608 };
609
610 const requestUninstallPlugin = (name) => {
611 if (!name) return;

Callers 4

requestUninstallPluginFunction · 0.70
uninstallExtensionFunction · 0.70
handleUninstallConfirmFunction · 0.70

Calls 5

resolveErrorMessageFunction · 0.90
requestUninstallFunction · 0.85
tmFunction · 0.85
getExtensionsFunction · 0.85
toastFunction · 0.70

Tested by

no test coverage detected