mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
Refactored ErrorNotification/ErrorPage
Added i18n for error codes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import ErrorNotification from "./ErrorNotification";
|
||||
import { BackendError } from "./errors";
|
||||
|
||||
type Props = {
|
||||
error: Error,
|
||||
@@ -10,18 +11,26 @@ type Props = {
|
||||
|
||||
class ErrorPage extends React.Component<Props> {
|
||||
render() {
|
||||
const { title, subtitle, error } = this.props;
|
||||
const { title, error } = this.props;
|
||||
|
||||
return (
|
||||
<section className="section">
|
||||
<div className="box column is-4 is-offset-4 container">
|
||||
<h1 className="title">{title}</h1>
|
||||
<p className="subtitle">{subtitle}</p>
|
||||
{this.renderSubtitle()}
|
||||
<ErrorNotification error={error} />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
renderSubtitle = () => {
|
||||
const { error, subtitle } = this.props;
|
||||
if (error instanceof BackendError) {
|
||||
return null;
|
||||
}
|
||||
return <p className="subtitle">{subtitle}</p>
|
||||
}
|
||||
}
|
||||
|
||||
export default ErrorPage;
|
||||
|
||||
Reference in New Issue
Block a user