Files
deighton-ar/mobile/src/Auth/Logout.js

22 lines
417 B
JavaScript

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