mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-18 02:31:19 +10:00
feat: refactor & redesign parts of UI
This commit is contained in:
@ -16,28 +16,19 @@ export default defineEventHandler(async (h3) => {
|
||||
});
|
||||
|
||||
// Verify collection exists and user owns it
|
||||
// Will not return the default collection
|
||||
const collection = await userLibraryManager.fetchCollection(id);
|
||||
if (!collection) {
|
||||
if (!collection)
|
||||
throw createError({
|
||||
statusCode: 404,
|
||||
statusMessage: "Collection not found",
|
||||
});
|
||||
}
|
||||
|
||||
if (collection.userId !== userId) {
|
||||
if (collection.userId !== userId)
|
||||
throw createError({
|
||||
statusCode: 403,
|
||||
statusMessage: "Not authorized to delete this collection",
|
||||
});
|
||||
}
|
||||
|
||||
// Don't allow deleting default collection
|
||||
if (collection.isDefault) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Cannot delete default collection",
|
||||
});
|
||||
}
|
||||
|
||||
await userLibraryManager.deleteCollection(id);
|
||||
return { success: true };
|
||||
|
||||
Reference in New Issue
Block a user