// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import {FormattedMessage} from 'react-intl'; import {invalidateAllCaches} from 'actions/admin_actions.jsx'; export default class PurgeCachesButton extends React.Component { constructor(props) { super(props); this.handlePurge = this.handlePurge.bind(this); this.state = { loading: false, fail: null }; } handlePurge(e) { e.preventDefault(); this.setState({ loading: true, fail: null }); invalidateAllCaches( () => { this.setState({ loading: false }); }, (err) => { this.setState({ loading: false, fail: err.message + ' - ' + err.detailed_error }); } ); } render() { let testMessage = null; if (this.state.fail) { testMessage = (