mattermost-mobile/app/components/retry_bar_indicator/index.js
2018-06-19 19:14:50 -04:00

25 lines
770 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {RequestStatus} from 'mattermost-redux/constants';
import {getConnection} from 'app/selectors/device';
import RetryBarIndicator from './retry_bar_indicator';
function mapStateToProps(state) {
const {websocket: websocketRequest} = state.requests.general;
const networkOnline = getConnection(state);
const webSocketOnline = websocketRequest.status === RequestStatus.SUCCESS;
let failed = state.views.channel.retryFailed && webSocketOnline;
if (!networkOnline) {
failed = false;
}
return {
failed,
};
}
export default connect(mapStateToProps)(RetryBarIndicator);