SPA: Router, Dashboard, Session/Agent/Settings Pages, Sidebar entfernt
This commit is contained in:
1 parent
25f07caf83
commit
80537c49ed
10 files changed
+522
-210
No files matched your search
@@ -13,6 +13,7 @@ public static class SessionEndpoint
|
||||
public static void MapSessionEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/api/sessions", HandleList);
|
||||
app.MapGet("/api/sessions/{sessionId}", HandleGet);
|
||||
app.MapPost("/api/sessions", HandleCreate);
|
||||
app.MapPut("/api/sessions/{sessionId}", HandleUpdate);
|
||||
}
|
||||
@@ -23,6 +24,23 @@ public static class SessionEndpoint
|
||||
await ctx.Response.WriteAsJsonAsync(sessions);
|
||||
}
|
||||
|
||||
private static async Task HandleGet(HttpContext ctx, DatabaseService db)
|
||||
{
|
||||
var sessionId = ctx.Request.RouteValues["sessionId"]?.ToString();
|
||||
if (string.IsNullOrEmpty(sessionId))
|
||||
{
|
||||
ctx.Response.StatusCode = 400;
|
||||
return;
|
||||
}
|
||||
var session = await db.GetSession(sessionId);
|
||||
if (session == null)
|
||||
{
|
||||
ctx.Response.StatusCode = 404;
|
||||
return;
|
||||
}
|
||||
await ctx.Response.WriteAsJsonAsync(session);
|
||||
}
|
||||
|
||||
private static async Task HandleCreate(HttpContext ctx, DatabaseService db)
|
||||
{
|
||||
var session = await db.CreateSession("Neue Session");
|
||||
|
||||
Reference in new issue
Block a user