Skip to content

Instantly share code, notes, and snippets.

@AndrejGajdos
Created June 24, 2018 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrejGajdos/9ca6bfc98bf62abb5ad0074a3f74f112 to your computer and use it in GitHub Desktop.
Save AndrejGajdos/9ca6bfc98bf62abb5ad0074a3f74f112 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import Cookies from 'js-cookie';
import { Redirect } from 'react-router';
import { AsyncHomeView, AsyncAboutView } from 'asyncViews';
export default function Routes() {
return (
<Switch>
<Route path="/" exact component={AsyncHomeView} />
<Route path="/about" component={AsyncAboutView} />
<Route
path="/facebook/success/"
render={() => (
<Redirect
to={{
pathname: Cookies.get('lastLocation_before_logging'),
state: { loadUser: true },
}}
/>
)}
/>
</Switch>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment