import React from 'react' import PropTypes from 'prop-types' import { api } from 'src/API' export class Logout extends React.Component { static propTypes = { history: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), } componentDidMount(event) { api.logout().then(() => { if (this.props.history) { this.props.history.replace('/login') } }) } render() { return null } }