diff --git a/src/main/controllers/web.zig b/src/main/controllers/web.zig index fe74618..d1feafd 100644 --- a/src/main/controllers/web.zig +++ b/src/main/controllers/web.zig @@ -282,20 +282,17 @@ const drive = struct { mkdir, }; - pub const Body = struct { - action: Action, - data: union(Action) { - mkdir: struct { - name: []const u8, - }, + pub const body_tag_from_query_param = "action"; + pub const Body = union(Action) { + mkdir: struct { + name: []const u8, }, }; pub fn handler(req: anytype, res: anytype, srv: anytype) !void { - if (req.body.action != req.body.data) return error.BadRequest; - switch (req.body.data) { - .mkdir => |data| { - _ = try srv.driveMkdir(req.args.path, data.name); + switch (req.body) { + .mkdir => |body| { + _ = try srv.driveMkdir(req.args.path, body.name); // TODO try servePage(req, res, srv); diff --git a/src/main/controllers/web/drive/directory.tmpl.html b/src/main/controllers/web/drive/directory.tmpl.html index 5135b6a..277174d 100644 --- a/src/main/controllers/web/drive/directory.tmpl.html +++ b/src/main/controllers/web/drive/directory.tmpl.html @@ -29,12 +29,11 @@ -