From 6522bbe2b1e0612508c48a7a06cbea89bd4674ae Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 14 Feb 2021 17:09:01 +0800 Subject: refactor: Refactor all pushAlert call. --- .../app/views/timeline-common/TimelineCardTemplate.tsx | 18 ++++++------------ .../src/app/views/timeline-common/TimelinePostEdit.tsx | 2 +- .../src/app/views/timeline-common/TimelinePostView.tsx | 5 +---- 3 files changed, 8 insertions(+), 17 deletions(-) (limited to 'FrontEnd/src/app/views/timeline-common') diff --git a/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx index d6eaa16c..c29e628d 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx @@ -68,12 +68,9 @@ function TimelineCardTemplate({ [timeline.isHighlight ? "delete" : "put"](timeline.name) .catch(() => { pushAlert({ - message: { - type: "i18n", - key: timeline.isHighlight - ? "timeline.removeHighlightFail" - : "timeline.addHighlightFail", - }, + message: timeline.isHighlight + ? "timeline.removeHighlightFail" + : "timeline.addHighlightFail", type: "danger", }); }); @@ -92,12 +89,9 @@ function TimelineCardTemplate({ [timeline.isBookmark ? "delete" : "put"](timeline.name) .catch(() => { pushAlert({ - message: { - type: "i18n", - key: timeline.isBookmark - ? "timeline.removeBookmarkFail" - : "timeline.addBookmarkFail", - }, + message: timeline.isBookmark + ? "timeline.removeBookmarkFail" + : "timeline.addBookmarkFail", type: "danger", }); }); diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostEdit.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostEdit.tsx index 3ce7d53b..09d066cc 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePostEdit.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePostEdit.tsx @@ -174,7 +174,7 @@ const TimelinePostEdit: React.FC = (props) => { (_) => { pushAlert({ type: "danger", - message: t("timeline.sendPostFailed"), + message: "timeline.sendPostFailed", }); setState("input"); } diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx index 7fd98310..d01ecfa8 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx @@ -93,10 +93,7 @@ const TimelinePostView: React.FC = (props) => { .then(onDeleted, () => { pushAlert({ type: "danger", - message: { - type: "i18n", - key: "timeline.deletePostFailed", - }, + message: "timeline.deletePostFailed", }); }); }} -- cgit v1.2.3