mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 08:41:15 +10:00
upload images to games
This commit is contained in:
@ -28,7 +28,13 @@ export default defineEventHandler(async (h3) => {
|
||||
if (!game)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid game ID" });
|
||||
|
||||
game.mImageLibrary = game.mImageLibrary.filter((e) => e != imageId);
|
||||
const imageIndex = game.mImageLibrary.findIndex((e) => e == imageId);
|
||||
if (imageIndex == -1)
|
||||
throw createError({ statusCode: 400, statusMessage: "Image not found" });
|
||||
|
||||
game.mImageLibrary.splice(imageIndex, 1);
|
||||
await h3.context.objects.delete(imageId);
|
||||
|
||||
if (game.mBannerId === imageId) {
|
||||
game.mBannerId = game.mImageLibrary[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user