Added ui error handling for 403 errors

This commit is contained in:
Philipp Czora
2019-03-04 11:49:12 +01:00
parent f68398e599
commit 6c06352de2
6 changed files with 28 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
//@flow
import React from "react";
import { translate } from "react-i18next";
import { BackendError, UnauthorizedError } from "./errors";
import { BackendError, ForbiddenError, UnauthorizedError } from "./errors";
import Notification from "./Notification";
import BackendErrorNotification from "./BackendErrorNotification";
@@ -27,7 +27,15 @@ class ErrorNotification extends React.Component<Props> {
</a>
</Notification>
);
} else {
} else if (error instanceof ForbiddenError) {
return (
<Notification type="danger">
<strong>{t("error-notification.prefix")}:</strong>{" "}
{t("error-notification.forbidden")}
</Notification>
)
} else
{
return (
<Notification type="danger">
<strong>{t("error-notification.prefix")}:</strong> {error.message}