Logout via AJAX
This commit is contained in:
@ -5,6 +5,7 @@ import { ConnectedBoardPage as BoardPage } from './BoardPage/BoardPage';
|
||||
import { ConnectedEditBoardPage as EditBoardPage } from './BoardPage/EditBoardPage';
|
||||
import { store } from '../store/store';
|
||||
import { Provider } from 'react-redux';
|
||||
import { logout } from '../store/actions/logout';
|
||||
|
||||
export class App extends React.Component {
|
||||
render() {
|
||||
@ -17,8 +18,8 @@ export class App extends React.Component {
|
||||
<Route path="/boards/:id" exact component={BoardPage} />
|
||||
<Route path="/boards/:id/edit" exact component={EditBoardPage} />
|
||||
<Route path="/logout" exact component={() => {
|
||||
window.location = "/logout";
|
||||
return null;
|
||||
this.logout();
|
||||
return <Redirect to="/" />;
|
||||
}} />
|
||||
<Route component={() => <Redirect to="/" />} />
|
||||
</Switch>
|
||||
@ -26,4 +27,8 @@ export class App extends React.Component {
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
|
||||
logout() {
|
||||
store.dispatch(logout());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user