From cfd6db6fb54e3e254c11db23f999a3bd756a6435 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 12 Dec 2017 19:19:12 +0000 Subject: [PATCH] Go back on successful save. --- src/Pim.tsx | 6 +++++- src/SyncGate.tsx | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Pim.tsx b/src/Pim.tsx index b09fe07..c66f420 100644 --- a/src/Pim.tsx +++ b/src/Pim.tsx @@ -32,6 +32,7 @@ class Pim extends React.Component { journals: JournalsData; entries: EntriesType; match: any; + history: any; }; constructor(props: any) { @@ -52,7 +53,10 @@ class Pim extends React.Component { return; } - store.dispatch(createJournalEntry(this.props.etesync, journal, entries.value, event.toIcal())); + let saveEvent = store.dispatch(createJournalEntry(this.props.etesync, journal, entries.value, event.toIcal())); + (saveEvent as any).then(() => { + this.props.history.goBack(); + }); } render() { diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index 82a398d..b5748f3 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -68,8 +68,14 @@ class SyncGate extends React.Component { /> ( - + render={({match, history}) => ( + )} />