Files
deighton-ar/website/src/Auth/Logout.js
2018-03-05 15:18:08 -08:00

22 lines
428 B
JavaScript

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
}
}