diff options
author | crupest <crupest@outlook.com> | 2021-01-03 19:38:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 19:38:05 +0800 |
commit | 418d631528fdb581a384068719e9af5dbaa66740 (patch) | |
tree | 42e2c0396a16cb5fbaaae665a238a8a031bef7f0 /FrontEnd/src/app/views/home/TimelineCreateDialog.tsx | |
parent | 4b3ae3edd9e8aceac5ff26ef137d2a8d686fe305 (diff) | |
parent | 8af803cb0da57af1355ad28cd056cb5dcf6d6915 (diff) | |
download | timeline-418d631528fdb581a384068719e9af5dbaa66740.tar.gz timeline-418d631528fdb581a384068719e9af5dbaa66740.tar.bz2 timeline-418d631528fdb581a384068719e9af5dbaa66740.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.tsx | 14 |
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}`} /> |