Created
June 29, 2015 22:19
-
-
Save dcousineau/b91ddb68e3d997667baf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Marty from 'marty'; | |
import {RouteHandler} from 'react-router'; | |
import Login from 'pages/user/login.jsx'; | |
export default Marty.createContainer(RouteHandler, { | |
listenTo: ["stores.AuthStore"], | |
fetch: { | |
user() { | |
return this.app.stores.AuthStore.fetchLoggedInUser(); | |
} | |
}, | |
pending() { | |
return ( | |
<h1>App Loading...</h1> | |
); | |
}, | |
failed(errors) { | |
return <Login redirectOnSuccess={false} />; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {Route, DefaultRoute, Redirect, HistoryLocation, create} from 'react-router'; | |
import AuthRequired from 'AuthRequired.jsx'; | |
import Layout from 'pages/layout.jsx'; | |
export let routes = [ | |
<Route name="auth-required" handler={AuthRequired}> | |
<Route name="index" handler={Layout} path="/"/> | |
</Route>, | |
<Route name="login" handler={Login} path="/log-in" /> | |
]; | |
export let location = typeof window !== "undefined" ? HistoryLocation : null; | |
export default create({ | |
routes, | |
location | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment