aboutsummaryrefslogtreecommitdiff
path: root/src/pages/create/thread.ts
blob: b3a02be5babaf1270c8b4717d8657e8d26dcc4d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { api } from '../../lib/api';
import { processThreadOut } from '../../lib/thread';
import Thread from '../../models/Thread';

export async function post({ request }) {
  const form = await request.formData();

  let t: Thread = await processThreadOut(form);

  console.log(t);

  await api('post', `thread/${form.get('board')}`, JSON.stringify(t));

  return new Response(t.id, {
    status: 200
  });
}