From 6d30af99760c65d326b979616f4e60a56655f37b Mon Sep 17 00:00:00 2001 From: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:28:01 +0100 Subject: [PATCH] Update usage of `useNotify` hook (#234) Co-authored-by: Michael Albert <37796947+awesome-michael@users.noreply.github.com> --- src/components/LoginPage.js | 2 +- src/components/RoomDirectory.js | 8 ++++++-- src/components/ServerNotices.js | 8 ++++++-- src/components/media.js | 20 +++++++++++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/components/LoginPage.js b/src/components/LoginPage.js index 1a78944..b31cae3 100644 --- a/src/components/LoginPage.js +++ b/src/components/LoginPage.js @@ -169,7 +169,7 @@ const LoginPage = ({ theme }) => { : typeof error === "undefined" || !error.message ? "ra.auth.sign_in_error" : error.message, - "warning" + { type: "warning" } ); }); }; diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js index 0284e14..5a9487f 100644 --- a/src/components/RoomDirectory.js +++ b/src/components/RoomDirectory.js @@ -87,7 +87,9 @@ export const RoomDirectoryBulkSaveButton = ({ selectedIds }) => { refresh(); }, onFailure: error => - notify("resources.room_directory.action.send_failure", "error"), + notify("resources.room_directory.action.send_failure", { + type: "error", + }), } ); }; @@ -119,7 +121,9 @@ export const RoomDirectorySaveButton = ({ record }) => { refresh(); }, onFailure: error => - notify("resources.room_directory.action.send_failure", "error"), + notify("resources.room_directory.action.send_failure", { + type: "error", + }), } ); }; diff --git a/src/components/ServerNotices.js b/src/components/ServerNotices.js index 6b9b95c..a8e186e 100644 --- a/src/components/ServerNotices.js +++ b/src/components/ServerNotices.js @@ -81,7 +81,9 @@ export const ServerNoticeButton = ({ record }) => { handleDialogClose(); }, onFailure: () => - notify("resources.servernotices.action.send_failure", "error"), + notify("resources.servernotices.action.send_failure", { + type: "error", + }), } ); }; @@ -127,7 +129,9 @@ export const ServerNoticeBulkButton = ({ selectedIds }) => { handleDialogClose(); }, onFailure: error => - notify("resources.servernotices.action.send_failure", "error"), + notify("resources.servernotices.action.send_failure", { + type: "error", + }), } ); }; diff --git a/src/components/media.js b/src/components/media.js index a628b79..aed1ee8 100644 --- a/src/components/media.js +++ b/src/components/media.js @@ -127,7 +127,9 @@ export const DeleteMediaButton = props => { handleDialogClose(); }, onFailure: () => - notify("resources.delete_media.action.send_failure", "error"), + notify("resources.delete_media.action.send_failure", { + type: "error", + }), } ); }; @@ -170,7 +172,9 @@ export const ProtectMediaButton = props => { refresh(); }, onFailure: () => - notify("resources.protect_media.action.send_failure", "error"), + notify("resources.protect_media.action.send_failure", { + type: "error", + }), } ); }; @@ -184,7 +188,9 @@ export const ProtectMediaButton = props => { refresh(); }, onFailure: () => - notify("resources.protect_media.action.send_failure", "error"), + notify("resources.protect_media.action.send_failure", { + type: "error", + }), } ); }; @@ -262,7 +268,9 @@ export const QuarantineMediaButton = props => { refresh(); }, onFailure: () => - notify("resources.quarantine_media.action.send_failure", "error"), + notify("resources.quarantine_media.action.send_failure", { + type: "error", + }), } ); }; @@ -276,7 +284,9 @@ export const QuarantineMediaButton = props => { refresh(); }, onFailure: () => - notify("resources.quarantine_media.action.send_failure", "error"), + notify("resources.quarantine_media.action.send_failure", { + type: "error", + }), } ); };