refactor notifications service
This commit is contained in:
1 parent
5b43d9d173
commit
d627a25b40
13 files changed
+132
-47
No files matched your search
@@ -32,13 +32,13 @@ const ActionMenu = ({ notification, onDelete }) => {
|
||||
|
||||
const handleRemove = (e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(notification._id);
|
||||
onDelete(notification.id);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
const handleConfigure = (e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/notifications/${notification._id}`);
|
||||
navigate(`/notifications/${notification.id}`);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ const CreateNotifications = () => {
|
||||
const [notification, setNotification] = useState({
|
||||
notificationName: "",
|
||||
address: "",
|
||||
type: NOTIFICATION_TYPES[0]._id,
|
||||
type: NOTIFICATION_TYPES[0].id,
|
||||
});
|
||||
const [errors, setErrors] = useState({});
|
||||
const { t } = useTranslation();
|
||||
@@ -66,7 +66,7 @@ const CreateNotifications = () => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const getNotificationTypeValue = (typeId) => {
|
||||
return NOTIFICATION_TYPES.find((type) => type._id === typeId)?.value || "email";
|
||||
return NOTIFICATION_TYPES.find((type) => type.id === typeId)?.value || "email";
|
||||
};
|
||||
|
||||
const extractError = (error, field) =>
|
||||
|
||||
@@ -100,7 +100,7 @@ const Notifications = () => {
|
||||
<Typography variant="h1">{t("notifications.createTitle")}</Typography>
|
||||
<DataTable
|
||||
config={{
|
||||
onRowClick: (row) => navigate(`/notifications/${row._id}`),
|
||||
onRowClick: (row) => navigate(`/notifications/${row.id}`),
|
||||
rowSX: {
|
||||
cursor: "pointer",
|
||||
"&:hover td": {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export const NOTIFICATION_TYPES = [
|
||||
{ _id: 1, name: "E-mail", value: "email" },
|
||||
{ _id: 2, name: "Slack", value: "slack" },
|
||||
{ _id: 3, name: "PagerDuty", value: "pager_duty" },
|
||||
{ _id: 4, name: "Webhook", value: "webhook" },
|
||||
{ _id: 5, name: "Discord", value: "discord" },
|
||||
{ _id: 6, name: "Matrix", value: "matrix" },
|
||||
{ id: 1, name: "E-mail", value: "email" },
|
||||
{ id: 2, name: "Slack", value: "slack" },
|
||||
{ id: 3, name: "PagerDuty", value: "pager_duty" },
|
||||
{ id: 4, name: "Webhook", value: "webhook" },
|
||||
{ id: 5, name: "Discord", value: "discord" },
|
||||
{ id: 6, name: "Matrix", value: "matrix" },
|
||||
];
|
||||
|
||||
export const TITLE_MAP = {
|
||||
|
||||
Reference in new issue
Block a user