You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
filepizza/src/components/ErrorPage.js

42 lines
790 B
JavaScript

import ErrorStore from '../stores/ErrorStore'
import React from 'react'
import Spinner from './Spinner'
export default class ErrorPage extends React.Component {
constructor() {
super()
this.state = ErrorStore.getState()
this._onChange = () => {
this.setState(ErrorStore.getState())
}
}
componentDidMount() {
ErrorStore.listen(this._onChange)
}
componentDidUnmount() {
ErrorStore.unlisten(this._onChange)
}
render() {
return <div className="page">
<Spinner dir="up" />
<h1 className="with-subtitle">FilePizza</h1>
<p className="subtitle">
<strong>{this.state.status}:</strong> {this.state.message}
</p>
{this.state.stack
? <pre>{this.state.stack}</pre>
: null}
</div>
}
}