mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-25 01:13:39 +10:00
* feat: support for file upload handler to track multiple files * feat: update image upload endpoint to allow multiple files * fix: lint
This commit is contained in:
@@ -14,19 +14,20 @@ export default defineEventHandler(async (h3) => {
|
||||
statusMessage: "This endpoint requires multipart form data.",
|
||||
});
|
||||
|
||||
const uploadResult = await handleFileUpload(h3, {}, ["internal:read"]);
|
||||
const uploadResult = await handleFileUpload(h3, {}, ["internal:read"], 1);
|
||||
if (!uploadResult)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Failed to upload file",
|
||||
});
|
||||
|
||||
const [imageId, options, pull, _dump] = uploadResult;
|
||||
const [imageIds, options, pull, _dump] = uploadResult;
|
||||
|
||||
const title = options.title;
|
||||
const description = options.description;
|
||||
const content = options.content;
|
||||
const tags = options.tags ? (JSON.parse(options.tags) as string[]) : [];
|
||||
const imageId = imageIds.at(0);
|
||||
|
||||
if (!title || !description || !content)
|
||||
throw createError({
|
||||
|
||||
Reference in New Issue
Block a user