blob: 0af3471569039e1e49f940d4c6382c719f232cee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import type { APIRoute } from 'astro';
import { v4 as uuidV4 } from 'uuid';
import type Thread from '../../models/Thread'
import { api } from '../../lib/api'
export async function post({ params, request }): APIRoute {
const form = await request.formData();
let t: Thread = {};
t.id = uuidV4().toString();
t.ThreadName = form.get('ThreadName').toString();
// data["ThreadCreator"] = locals.userid;
t.ThreadCreator = '';
t.ThreadText = form.get('ThreadText').toString();
t.Comments = [];
t.CreationDate = Date.now();
// data["ImageId"] = await post_img(base64image, writeFileSync);
// data["FileType"] = get_img_type(base64image);
t.ImageId = form.get('image').toString();
t.FileType = '';
// await api('post', `thread/${form.get('board')}`, JSON.stringify(data));
return new Response(null, {
status: 200
});
}
|