web: only show message on server error
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
dfff2a1134
commit
fc17580d9a
|
@ -6,7 +6,7 @@ import { showMessage } from "./MessageContainer";
|
||||||
export class MessageMiddleware implements Middleware {
|
export class MessageMiddleware implements Middleware {
|
||||||
|
|
||||||
post(context: ResponseContext): Promise<Response | void> {
|
post(context: ResponseContext): Promise<Response | void> {
|
||||||
if (!context.response.ok) {
|
if (context.response.status >= 500) {
|
||||||
showMessage({
|
showMessage({
|
||||||
level: MessageLevel.error,
|
level: MessageLevel.error,
|
||||||
message: gettext("API request failed"),
|
message: gettext("API request failed"),
|
||||||
|
|
Reference in New Issue