Changes backend in preparation for frontend work
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SlpModularCms.Core.Availability;
|
||||
using SlpModularCms.Core.Exceptions;
|
||||
@@ -48,13 +49,17 @@ public class AvailabilityMiddleware
|
||||
_logger.LogWarning("Request geblokkeerd vanwege systeemstatus: {Status}. Path: {Path}", status, context.Request.Path);
|
||||
|
||||
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||
var response = new ApiErrorResponse(
|
||||
Message: status == AvailabilityStatus.Maintenance
|
||||
var problemDetails = new ProblemDetails
|
||||
{
|
||||
Status = StatusCodes.Status503ServiceUnavailable,
|
||||
Title = "Service Unavailable",
|
||||
Detail = status == AvailabilityStatus.Maintenance
|
||||
? "Het systeem is momenteel in onderhoud. Probeer het later opnieuw."
|
||||
: "De service is tijdelijk niet beschikbaar."
|
||||
);
|
||||
: "De service is tijdelijk niet beschikbaar.",
|
||||
Instance = context.Request.Path
|
||||
};
|
||||
|
||||
await context.Response.WriteAsJsonAsync(response);
|
||||
await context.Response.WriteAsJsonAsync(problemDetails);
|
||||
}
|
||||
|
||||
private bool IsAdminBypass(HttpContext context)
|
||||
|
||||
Reference in New Issue
Block a user