ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit 67813fbbb873df8b2c8005e1630c2036097e6d7e
parent 733df18214b289d1d0a1db49a1e55c900d2afefc
Author: Konstantin Tarkus <hello@tarkus.me>
Date:   Sat,  9 May 2015 17:43:46 +0300

Load page data inside the AppActions.navigateTo(...) method

Diffstat:
Msrc/actions/AppActions.js | 22++++++++++++----------
Msrc/components/App/App.js | 4+---
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/actions/AppActions.js b/src/actions/AppActions.js @@ -1,24 +1,26 @@ /*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import http from 'superagent'; -import ExecutionEnvironment from 'react/lib/ExecutionEnvironment'; +import { canUseDOM } from 'react/lib/ExecutionEnvironment'; import Dispatcher from '../core/Dispatcher'; import { ActionTypes } from '../core/Constants'; export default { navigateTo(path, options) { - if (ExecutionEnvironment.canUseDOM) { - if (options && options.replace) { - window.history.replaceState({}, document.title, path); - } else { - window.history.pushState({}, document.title, path); + this.loadPage(path, () => { + if (canUseDOM) { + if (options && options.replace) { + window.history.replaceState({}, document.title, path); + } else { + window.history.pushState({}, document.title, path); + } } - } - Dispatcher.dispatch({ - type: ActionTypes.CHANGE_LOCATION, - path + Dispatcher.dispatch({ + type: ActionTypes.CHANGE_LOCATION, + path + }); }); }, diff --git a/src/components/App/App.js b/src/components/App/App.js @@ -130,9 +130,7 @@ class App { var path = el.pathname + el.search + (el.hash || ''); event.preventDefault(); - AppActions.loadPage(path, () => { - AppActions.navigateTo(path); - }); + AppActions.navigateTo(path); } }