button started doing something
This commit is contained in:
parent
3173264ec5
commit
e674f6e118
@ -15,6 +15,14 @@
|
||||
let hidden: boolean = $derived(mobile ? $pane !== 'preview' : true);
|
||||
|
||||
let output: Promise<string> = $derived(renderPreview(markdown, stylesheet));
|
||||
|
||||
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 }));
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class:hidden class:mobile data-testid="preview-pane">
|
||||
@ -22,7 +30,7 @@
|
||||
<p>processing...</p>
|
||||
{:then result}
|
||||
<iframe title="résumé preview" srcdoc={result}></iframe>
|
||||
<button>
|
||||
<button type="submit" onclick={performRender}>
|
||||
<span>download</span>
|
||||
<iconify-icon icon="ion:download-outline" height="1.25em"></iconify-icon>
|
||||
</button>
|
||||
|
@ -1,13 +1,11 @@
|
||||
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);
|
||||
|
||||
return json({ msg: 'to be implemented' });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user