all repos — caroster @ v0.3.0

[Octree] Group carpool to your event https://caroster.io

app/src/containers/ErrorBoundary/LogoutAndRedirect.js (view raw)

 1import React, {useEffect} from 'react';
 2import {Redirect} from 'react-router-dom';
 3import {useAuth} from 'strapi-react-context';
 4
 5const LogoutAndRedirect = () => {
 6  const {logout, token} = useAuth();
 7  useEffect(() => {
 8    logout();
 9  }, [logout]);
10  if (token) return null;
11  return <Redirect to="/" />;
12};
13
14export default LogoutAndRedirect;