added translation

This commit is contained in:
Florian Scholdei
2018-12-12 13:35:58 +01:00
parent 8927d56b5c
commit b27e3d2600
2 changed files with 21 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
import React from "react";
import { translate } from "react-i18next";
import Notification from "./Notification";
import {UNAUTHORIZED_ERROR} from "./apiclient";
type Props = {
t: string => string,
@@ -9,15 +10,27 @@ type Props = {
};
class ErrorNotification extends React.Component<Props> {
render() {
const { t, error } = this.props;
if (error) {
if (error === UNAUTHORIZED_ERROR) {
return (
<Notification type="danger">
<strong>{t("error-notification.prefix")}:</strong> {t("error-notification.timeout")}
{" "}
<a href="javascript:window.location.reload(true)">{t("error-notification.loginLink")}</a>
</Notification>
);
} else {
return (
<Notification type="danger">
<strong>{t("error-notification.prefix")}:</strong> {error.message}
</Notification>
);
}
}
return null;
}
}

View File

@@ -20,7 +20,9 @@
}
},
"error-notification": {
"prefix": "Error"
"prefix": "Error",
"loginLink": "You can login here again.",
"timeout": "The session has expired."
},
"loading": {
"alt": "Loading ..."