Skip to content

Instantly share code, notes, and snippets.

@hoony-o-1
Last active November 25, 2017 15:49
Show Gist options
  • Save hoony-o-1/8413ef0576fd02f01e7f7c3b795a8b11 to your computer and use it in GitHub Desktop.
Save hoony-o-1/8413ef0576fd02f01e7f7c3b795a8b11 to your computer and use it in GitHub Desktop.
const ProtectedComponent = ({ Component, path }) => {
switch (this.state.token) {
case '':
return <DefaultLayout path={path} Component={LoadingContainer} />
case 'UNAUTHORIZED':
return <Redirect to="/login" />
default:
return <DefaultLayout path={path} component={Component} />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment