// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import $ from 'jquery'; import PropTypes from 'prop-types'; import React from 'react'; import {FormattedMessage} from 'react-intl'; import {Link} from 'react-router/es6'; import {ErrorPageTypes} from 'utils/constants.jsx'; import * as Utils from 'utils/utils.jsx'; export default class ErrorPage extends React.Component { static propTypes = { location: PropTypes.object.isRequired }; componentDidMount() { $('body').attr('class', 'sticky error'); } componentWillUnmount() { $('body').attr('class', ''); } renderTitle = () => { switch (this.props.location.query.type) { case ErrorPageTypes.LOCAL_STORAGE: return ( ); case ErrorPageTypes.PERMALINK_NOT_FOUND: return ( ); case ErrorPageTypes.PAGE_NOT_FOUND: return ( ); } if (this.props.location.query.title) { return this.props.location.query.title; } return Utils.localizeMessage('error.generic.title', 'Error'); } renderMessage = () => { switch (this.props.location.query.type) { case ErrorPageTypes.LOCAL_STORAGE: return (
); case ErrorPageTypes.PERMALINK_NOT_FOUND: return (

); case ErrorPageTypes.OAUTH_MISSING_CODE: return (

); case ErrorPageTypes.PAGE_NOT_FOUND: return (

); } if (this.props.location.query.message) { return

{this.props.location.query.message}

; } return (

); } renderLink = (url, id, defaultMessage) => { return ( ); } render() { const title = this.renderTitle(); const message = this.renderMessage(); return (

{title}

{message}
); } }