import { api } from '../../lib/api'; import { processCommentOut } from '../../lib/thread'; import Comment from '../../models/Thread'; export async function post({ request }) { const form = await request.formData(); let c: Comment = processCommentOut(form); let r = await api('post', `board/${form.get('board')}/${form.get('tid')}`, JSON.stringify(c)); return new Response((r.status == 200) ? 'close' : await r.text(), { status: r.status }); }