|
@@ -10,12 +10,15 @@ import { apiv3Delete } from '~/client/util/apiv3-client';
|
|
|
import { toastSuccess, toastError } from '~/client/util/toastr';
|
|
import { toastSuccess, toastError } from '~/client/util/toastr';
|
|
|
import { usePluginDeleteModal } from '~/stores/modal';
|
|
import { usePluginDeleteModal } from '~/stores/modal';
|
|
|
|
|
|
|
|
|
|
+import { useSWRxAdminPlugins } from '../../../stores/admin-plugins';
|
|
|
|
|
+
|
|
|
|
|
|
|
|
export const PluginDeleteModal: React.FC = () => {
|
|
export const PluginDeleteModal: React.FC = () => {
|
|
|
|
|
|
|
|
const { t } = useTranslation('admin');
|
|
const { t } = useTranslation('admin');
|
|
|
|
|
+ const { mutate } = useSWRxAdminPlugins();
|
|
|
const { data: pluginDeleteModal, close: closePluginDeleteModal } = usePluginDeleteModal();
|
|
const { data: pluginDeleteModal, close: closePluginDeleteModal } = usePluginDeleteModal();
|
|
|
- const isShown = pluginDeleteModal?.isShown;
|
|
|
|
|
|
|
+ const isOpen = pluginDeleteModal?.isOpen;
|
|
|
const name = pluginDeleteModal?.name;
|
|
const name = pluginDeleteModal?.name;
|
|
|
const url = pluginDeleteModal?.url;
|
|
const url = pluginDeleteModal?.url;
|
|
|
const id = pluginDeleteModal?.id;
|
|
const id = pluginDeleteModal?.id;
|
|
@@ -32,11 +35,12 @@ export const PluginDeleteModal: React.FC = () => {
|
|
|
const pluginName = res.data.pluginName;
|
|
const pluginName = res.data.pluginName;
|
|
|
closePluginDeleteModal();
|
|
closePluginDeleteModal();
|
|
|
toastSuccess(t('toaster.remove_plugin_success', { pluginName }));
|
|
toastSuccess(t('toaster.remove_plugin_success', { pluginName }));
|
|
|
|
|
+ mutate();
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
|
}
|
|
}
|
|
|
- }, [id, closePluginDeleteModal, t]);
|
|
|
|
|
|
|
+ }, [id, closePluginDeleteModal, t, mutate]);
|
|
|
|
|
|
|
|
const headerContent = () => {
|
|
const headerContent = () => {
|
|
|
return (
|
|
return (
|
|
@@ -66,7 +70,7 @@ export const PluginDeleteModal: React.FC = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Modal isOpen={isShown} toggle={toggleHandler}>
|
|
|
|
|
|
|
+ <Modal isOpen={isOpen} toggle={toggleHandler}>
|
|
|
<ModalHeader tag="h4" toggle={toggleHandler} className="bg-danger text-light" name={name}>
|
|
<ModalHeader tag="h4" toggle={toggleHandler} className="bg-danger text-light" name={name}>
|
|
|
{headerContent()}
|
|
{headerContent()}
|
|
|
</ModalHeader>
|
|
</ModalHeader>
|