aboutsummaryrefslogtreecommitdiff
path: root/src/pages/create/thread.ts
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
commit9dfd6aa77518b3a1e6bfd926a3b7719c32a8c97f (patch)
treed10fc76ef816160871e3955aa75821bc5d5088d4 /src/pages/create/thread.ts
parent4ca81621e5b31922565b4149ebad1deb5161071a (diff)
use the new api
Diffstat (limited to 'src/pages/create/thread.ts')
-rw-r--r--src/pages/create/thread.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/pages/create/thread.ts b/src/pages/create/thread.ts
index b3a02be..12702ba 100644
--- a/src/pages/create/thread.ts
+++ b/src/pages/create/thread.ts
@@ -3,15 +3,13 @@ import { processThreadOut } from '../../lib/thread';
import Thread from '../../models/Thread';
export async function post({ request }) {
- const form = await request.formData();
+ const form = await request.formData();
- let t: Thread = await processThreadOut(form);
+ let t: Thread = processThreadOut(form);
- console.log(t);
+ let r = await api('post', `board/${form.get('board')}`, JSON.stringify(t));
- await api('post', `thread/${form.get('board')}`, JSON.stringify(t));
-
- return new Response(t.id, {
- status: 200
- });
+ return new Response(await r.text(), {
+ status: r.status
+ });
}