aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/home/TimelineCreateDialog.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-03 19:38:05 +0800
committerGitHub <noreply@github.com>2021-01-03 19:38:05 +0800
commitd6f5cc98880b4664baf223d7147feb466e3cce5d (patch)
treeccc1167e69d7e8fcc58760e2d7de3a534150cff3 /FrontEnd/src/app/views/home/TimelineCreateDialog.tsx
parentd25b74fa167944a7701997e34810a2ffc3c39edd (diff)
parent1b7a9096b1fd7c26a9336950a4a4b4253bcb5926 (diff)
downloadtimeline-d6f5cc98880b4664baf223d7147feb466e3cce5d.tar.gz
timeline-d6f5cc98880b4664baf223d7147feb466e3cce5d.tar.bz2
timeline-d6f5cc98880b4664baf223d7147feb466e3cce5d.zip
Merge pull request #197 from crupest/front-dev
Front: Highlight and bookmark timeline and new home page.
Diffstat (limited to 'FrontEnd/src/app/views/home/TimelineCreateDialog.tsx')
-rw-r--r--FrontEnd/src/app/views/home/TimelineCreateDialog.tsx14
1 files changed, 8 insertions, 6 deletions
diff --git a/FrontEnd/src/app/views/home/TimelineCreateDialog.tsx b/FrontEnd/src/app/views/home/TimelineCreateDialog.tsx
index 12bbfb54..5dcba612 100644
--- a/FrontEnd/src/app/views/home/TimelineCreateDialog.tsx
+++ b/FrontEnd/src/app/views/home/TimelineCreateDialog.tsx
@@ -1,7 +1,11 @@
import React from "react";
import { useHistory } from "react-router";
-import { validateTimelineName, timelineService } from "@/services/timeline";
+import {
+ validateTimelineName,
+ timelineService,
+ TimelineInfo,
+} from "@/services/timeline";
import OperationDialog from "../common/OperationDialog";
interface TimelineCreateDialogProps {
@@ -12,8 +16,6 @@ interface TimelineCreateDialogProps {
const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = (props) => {
const history = useHistory();
- let nameSaved: string;
-
return (
<OperationDialog
open={props.open}
@@ -40,11 +42,11 @@ const TimelineCreateDialog: React.FC<TimelineCreateDialogProps> = (props) => {
return null;
}
}}
- onProcess={([name]) => {
+ onProcess={([name]): Promise<TimelineInfo> => {
return timelineService.createTimeline(name).toPromise();
}}
- onSuccessAndClose={() => {
- history.push(`timelines/${nameSaved}`);
+ onSuccessAndClose={(timeline: TimelineInfo) => {
+ history.push(`timelines/${timeline.name}`);
}}
failurePrompt={(e) => `${e as string}`}
/>