aboutsummaryrefslogtreecommitdiff
path: root/src/pages/create/comment.ts
blob: ebc0323e02a534be733ccf42c4555f8081ffd2e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
    });
}