playing around with submission some more
This commit is contained in:
parent
e674f6e118
commit
395bd3394e
@ -18,10 +18,13 @@
|
||||
|
||||
async function performRender(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
const data = new FormData();
|
||||
data.append('markdown', markdown);
|
||||
data.append('stylesheet', stylesheet);
|
||||
console.log(await fetch('/render', { method: 'POST', body: data }));
|
||||
console.log(
|
||||
await fetch('/render', {
|
||||
method: 'POST',
|
||||
body: await output,
|
||||
headers: { 'content-type': 'text/html' },
|
||||
}),
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,11 +1,16 @@
|
||||
import { error, json, type RequestEvent } from '@sveltejs/kit';
|
||||
|
||||
export async function POST({ request }: RequestEvent) {
|
||||
if (!(request.headers.get('Content-Type') ?? 'bad').includes('text/html')) {
|
||||
error(400, 'request body not HTML');
|
||||
}
|
||||
|
||||
if (!request.body) {
|
||||
error(400, 'no body in request');
|
||||
}
|
||||
|
||||
console.log(request);
|
||||
const input = await request.text();
|
||||
console.log('received input: ', input);
|
||||
|
||||
return json({ msg: 'to be implemented' });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user