Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dzikowski
committed
May 17, 2017
1 parent
b1963ac
commit f9cd696
Showing
18 changed files
with
197 additions
and
210 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from "react"; | ||
import {Home} from "./home/Home"; | ||
import ProfileRoutes from "./profile/ProfileRoutes"; | ||
import {DefaultRoute} from "./common/routes"; | ||
import React from 'react'; | ||
import { Home } from './home/Home'; | ||
import ProfileRoutes from './profile/ProfileRoutes'; | ||
import { DefaultRoute } from './common/routes'; | ||
|
||
const Routes = ({user, auth, ...rest}) => ( | ||
const Routes = ({ user, auth, ...rest }) => ( | ||
<div> | ||
<DefaultRoute exact path="/" component={Home}/> | ||
<ProfileRoutes user={user} auth={auth}/> | ||
<DefaultRoute exact path="/" component={Home} /> | ||
<ProfileRoutes user={user} auth={auth} /> | ||
</div> | ||
); | ||
|
||
export default Routes; | ||
export default Routes; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import React from "react"; | ||
import {Route, Redirect} from "react-router-dom"; | ||
import React from 'react'; | ||
import { Route, Redirect } from 'react-router-dom'; | ||
|
||
const mergedProps = (...props) => Object.assign({}, ...props); | ||
|
||
export const DefaultRoute = ({component: Component, ...rest}) => ( | ||
export const DefaultRoute = ({ component: Component, ...rest }) => ( | ||
<Route | ||
{...rest} | ||
render={(props) => <Component {...mergedProps(rest, props)} />} | ||
render={props => <Component {...mergedProps(rest, props)} />} | ||
/> | ||
); | ||
|
||
export const PublicRoute = ({component: Component, user, ...rest}) => ( | ||
export const PublicRoute = ({ component: Component, user, ...rest }) => ( | ||
<Route | ||
{...rest} | ||
render={(props) => user.signedIn === false | ||
? <Component {...mergedProps({user}, rest, props)} /> | ||
: <Redirect to={{pathname: '/', state: {from: props.location}}}/>} | ||
render={props => user.signedIn === false | ||
? <Component {...mergedProps({ user }, rest, props)} /> | ||
: <Redirect to={{ pathname: '/', state: { from: props.location } }} />} | ||
/> | ||
); | ||
|
||
export const PrivateRoute = ({component: Component, user, ...rest}) => ( | ||
export const PrivateRoute = ({ component: Component, user, ...rest }) => ( | ||
<Route | ||
{...rest} | ||
render={(props) => user.signedIn === true | ||
? <Component {...mergedProps({user}, rest, props)} /> | ||
: <Redirect to={{pathname: '/', state: {from: props.location}}}/>} | ||
render={props => user.signedIn === true | ||
? <Component {...mergedProps({ user }, rest, props)} /> | ||
: <Redirect to={{ pathname: '/', state: { from: props.location } }} />} | ||
/> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const cognitoConfig = { | ||
poolId: COGNITO_POOL_ID, | ||
appClientId: COGNITO_APP_CLIENT_ID | ||
}; | ||
appClientId: COGNITO_APP_CLIENT_ID, | ||
}; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from "react"; | ||
import React from 'react'; | ||
|
||
export const Home = () => ( | ||
<div> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import "./styles/app.css" | ||
import App from "./App" | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './styles/app.css'; | ||
import App from './App'; | ||
|
||
ReactDOM.render(<App/>, document.getElementById('app')); | ||
ReactDOM.render(<App />, document.getElementById('app')); |
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
Oops, something went wrong.