diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-10-24 23:19:33 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-10-24 23:19:33 +0300 |
commit | 9dfd6aa77518b3a1e6bfd926a3b7719c32a8c97f (patch) | |
tree | d10fc76ef816160871e3955aa75821bc5d5088d4 /src/pages/create/comment.ts | |
parent | 4ca81621e5b31922565b4149ebad1deb5161071a (diff) |
use the new api
Diffstat (limited to 'src/pages/create/comment.ts')
-rw-r--r-- | src/pages/create/comment.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/pages/create/comment.ts b/src/pages/create/comment.ts index f8d4c82..ebc0323 100644 --- a/src/pages/create/comment.ts +++ b/src/pages/create/comment.ts @@ -3,15 +3,13 @@ import { processCommentOut } from '../../lib/thread'; import Comment from '../../models/Thread'; export async function post({ request }) { - const form = await request.formData(); + const form = await request.formData(); - let c: Comment = await processCommentOut(form); + let c: Comment = processCommentOut(form); - console.log(c); + let r = await api('post', `board/${form.get('board')}/${form.get('tid')}`, JSON.stringify(c)); - await api('post', `comment/${form.get('board')}/${form.get('tid')}`, JSON.stringify(c)); - - return new Response('close', { - status: 200 - }); + return new Response((r.status == 200) ? 'close' : await r.text(), { + status: r.status + }); } |