@tsc_tech/medusa-plugin-notification-template
Version:
51 lines (50 loc) • 1.79 kB
JavaScript
import { jsxs, jsx } from "react/jsx-runtime";
import { PencilSquare, Trash } from "@medusajs/icons";
import { useNavigate } from "react-router-dom";
import { IconButton, Prompt } from "@medusajs/ui";
import { sdk } from "../utils/sdk.js";
const NotificationTemplateRowActions = ({
notificationTemplate
}) => {
const navigation = useNavigate();
const handleDelete = async () => {
await sdk.client.fetch(
`/admin/notification-template/${notificationTemplate.id}`,
{
method: "DELETE"
}
);
navigation("/notification-template");
navigation(0);
};
return /* @__PURE__ */ jsxs("div", { className: "gap-2 flex", children: [
/* @__PURE__ */ jsx(
IconButton,
{
onClick: () => navigation(`/notification-template/edit`, {
state: notificationTemplate
}),
children: /* @__PURE__ */ jsx(PencilSquare, {})
}
),
/* @__PURE__ */ jsxs(Prompt, { children: [
/* @__PURE__ */ jsx(Prompt.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { children: /* @__PURE__ */ jsx(Trash, {}) }) }),
/* @__PURE__ */ jsxs(Prompt.Content, { children: [
/* @__PURE__ */ jsxs(Prompt.Header, { children: [
/* @__PURE__ */ jsxs(Prompt.Title, { children: [
"Delete ",
notificationTemplate.event_name
] }),
/* @__PURE__ */ jsx(Prompt.Description, { children: "Are you sure? This cannot be undone." })
] }),
/* @__PURE__ */ jsxs(Prompt.Footer, { children: [
/* @__PURE__ */ jsx(Prompt.Cancel, { children: "Cancel" }),
/* @__PURE__ */ jsx(Prompt.Action, { onClick: handleDelete, children: "Delete" })
] })
] })
] })
] });
};
export {
NotificationTemplateRowActions
};