aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/timeline-common/Timeline.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-19 16:23:27 +0800
committercrupest <crupest@outlook.com>2021-01-19 16:23:27 +0800
commitc3cf26a7788d97135e0f2a3e247e6cbe6b1b9664 (patch)
treec5e399a7651e99746ea60bb8ec27d88d2e06c059 /FrontEnd/src/app/views/timeline-common/Timeline.tsx
parenta5deeea162433c52a3b07c20b34831522ee01acb (diff)
downloadtimeline-c3cf26a7788d97135e0f2a3e247e6cbe6b1b9664.tar.gz
timeline-c3cf26a7788d97135e0f2a3e247e6cbe6b1b9664.tar.bz2
timeline-c3cf26a7788d97135e0f2a3e247e6cbe6b1b9664.zip
...
Diffstat (limited to 'FrontEnd/src/app/views/timeline-common/Timeline.tsx')
-rw-r--r--FrontEnd/src/app/views/timeline-common/Timeline.tsx16
1 files changed, 13 insertions, 3 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
index 2446c0dd..288be141 100644
--- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx
+++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
@@ -6,11 +6,12 @@ import {
TimelinePostInfo,
timelineService,
} from "@/services/timeline";
+import { useUser } from "@/services/user";
+import { pushAlert } from "@/services/alert";
import TimelineItem from "./TimelineItem";
import TimelineTop from "./TimelineTop";
import TimelineDateItem from "./TimelineDateItem";
-import { useUser } from "@/services/user";
function dateEqual(left: Date, right: Date): boolean {
return (
@@ -25,7 +26,6 @@ export interface TimelineProps {
style?: React.CSSProperties;
timeline: TimelineInfo;
posts: TimelinePostInfo[];
- onDelete: (post: TimelinePostInfo) => void;
}
const Timeline: React.FC<TimelineProps> = (props) => {
@@ -87,7 +87,17 @@ const Timeline: React.FC<TimelineProps> = (props) => {
old === post.index ? -1 : post.index
),
onDelete: () => {
- props.onDelete(post);
+ timelineService
+ .deletePost(timeline.name, post.id)
+ .catch(() => {
+ pushAlert({
+ type: "danger",
+ message: {
+ type: "i18n",
+ key: "timeline.deletePostFailed",
+ },
+ });
+ });
},
}
: undefined