From 7a386c43c95e9baea05c798b4cf1c32f8a72ac01 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Fri, 1 Jan 2021 23:20:21 +0800
Subject: ...

---
 FrontEnd/src/app/views/home/TimelineCreateDialog.tsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'FrontEnd/src/app/views/home/TimelineCreateDialog.tsx')

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}`}
     />
-- 
cgit v1.2.3

