From 0166f7da153d0fcdda8a5247d895295550b9a508 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 5 Jan 2016 12:26:14 -0800 Subject: [PATCH] Use isPrimed api for getUser fetch action --- common/app/App.jsx | 3 +++ common/app/flux/Actions.js | 11 +++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/common/app/App.jsx b/common/app/App.jsx index 1307166924..847542cce4 100644 --- a/common/app/App.jsx +++ b/common/app/App.jsx @@ -8,6 +8,9 @@ export default contain( { store: 'appStore', fetchAction: 'appActions.getUser', + isPrimed({ username }) { + return !!username; + }, getPayload(props) { return { isPrimed: !!props.username diff --git a/common/app/flux/Actions.js b/common/app/flux/Actions.js index cc3a3dfe00..d0e873b35c 100644 --- a/common/app/flux/Actions.js +++ b/common/app/flux/Actions.js @@ -1,4 +1,5 @@ import { Actions } from 'thundercats'; +import { Observable } from 'rx'; export default Actions({ @@ -9,11 +10,7 @@ export default Actions({ return { title: title + ' | Free Code Camp' }; }, - getUser({ isPrimed }) { - if (isPrimed) { - return null; - } - + getUser() { return this.readService$('user', null, null) .map(({ username, @@ -30,9 +27,7 @@ export default Actions({ isFullStackCert }; }) - .catch(err => { - console.error(err); - }); + .catch(err => Observable.just({ err })); }, // routing