From 8a02348ddbaf8e1de2fcd1f4a83bc541cdc6a262 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 19 Oct 2015 15:38:48 -0700 Subject: [PATCH] Clear job from localStorage on submit --- common/app/routes/Jobs/components/Preview.jsx | 1 + common/app/routes/Jobs/flux/Actions.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/common/app/routes/Jobs/components/Preview.jsx b/common/app/routes/Jobs/components/Preview.jsx index a6249e4b2a..9c805266ac 100644 --- a/common/app/routes/Jobs/components/Preview.jsx +++ b/common/app/routes/Jobs/components/Preview.jsx @@ -38,6 +38,7 @@ export default contain( block={ true } className='signup-btn' onClick={ () => { + jobActions.clearSavedForm(); jobActions.saveJobToDb({ goTo: '/jobs/new/check-out', job diff --git a/common/app/routes/Jobs/flux/Actions.js b/common/app/routes/Jobs/flux/Actions.js index d14d83716d..9a979671b4 100644 --- a/common/app/routes/Jobs/flux/Actions.js +++ b/common/app/routes/Jobs/flux/Actions.js @@ -58,6 +58,7 @@ export default Actions({ }, saveForm: null, getSavedForm: null, + clearSavedForm: null, setForm(form) { return { form }; }, @@ -107,6 +108,10 @@ export default Actions({ } }); + jobActions.clearSavedForm.subscribe(() => { + store.remove('newJob'); + }); + jobActions.saveJobToDb.subscribe(({ goTo, job }) => { const appActions = cat.getActions('appActions'); services.create('jobs', { job }, null, (err, job) => { @@ -133,5 +138,6 @@ export default Actions({ err => jobActions.setError(err) ); }); + return jobActions; });