Skip to content

Commit

Permalink
fix body not saving/loading properly
Browse files Browse the repository at this point in the history
  • Loading branch information
loudar committed Jul 17, 2024
1 parent d3da2d2 commit f937801
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/ui/templates/generic.templates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,14 @@ export class GenericTemplates {
}

static bodyEditor(request, headers) {
const body = signal(request.body);
body.subscribe((val) => {
request.updateBody(val);
});
const body = computedSignal(request.signal, req => req ? req.body : null);
const contentType = computedSignal(headers, h => h ? h["Content-Type"] : "text/plain");

return create("div")
.classes("flex-v")
.children(
GenericTemplates.textArea(body, null, "body", (val) => {
body.value = val;
request.updateBody(val);
}),
ifjs(body, create("span")
.text("Preview")
Expand All @@ -470,7 +467,7 @@ export class GenericTemplates {
.oninput((e) => {
oninput(e.target.value);
})
.text(value)
.value(value)
.build()
).build();
}
Expand Down

0 comments on commit f937801

Please sign in to comment.