Skip to content

Commit b62b527

Browse files
committed
use location.state in transitions
1 parent 824ed63 commit b62b527

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/auth-flow/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { findDOMNode } from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { HashHistory } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link, Navigation } from 'react-router';
44
import auth from './auth';
55

@@ -76,8 +76,8 @@ var Login = React.createClass({
7676

7777
var { location } = this.props;
7878

79-
if (location.query && location.query.nextPathname) {
80-
this.replaceWith(location.query.nextPathname);
79+
if (location.query && location.state.nextPathname) {
80+
this.replaceWith(location.state.nextPathname);
8181
} else {
8282
this.replaceWith('/about');
8383
}
@@ -116,11 +116,11 @@ var Logout = React.createClass({
116116

117117
function requireAuth(nextState, transition) {
118118
if (!auth.loggedIn())
119-
transition.to('/login', { nextPathname: nextState.location.pathname });
119+
transition.to('/login', null, { nextPathname: nextState.location.pathname });
120120
}
121121

122122
React.render((
123-
<Router history={HashHistory}>
123+
<Router history={new HashHistory({ queryKey: true })}>
124124
<Route path="/" component={App}>
125125
<Route path="login" component={Login}/>
126126
<Route path="logout" component={Logout}/>

0 commit comments

Comments
 (0)