From 6de6e5a393c61b1c9eb1b8ce25d08d3400eb49e0 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 5 Dec 2022 23:05:47 -0800 Subject: [PATCH] undo temp --- .../server/api/endpoints/users/lists/delete.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/users/lists/delete.ts b/packages/backend/src/server/api/endpoints/users/lists/delete.ts index 384b7d7132..5a7613c98a 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/delete.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/delete.ts @@ -30,18 +30,14 @@ export const paramDef = { // eslint-disable-next-line import/no-default-export export default define(meta, paramDef, async (ps, user) => { - while (await UserLists.findOneBy({ + const userList = await UserLists.findOneBy({ + id: ps.listId, userId: user.id, - }) != null) { - const userList = await UserLists.findOneBy({ - // id: ps.listId, - userId: user.id, - }); + }); - if (userList == null) { - throw new ApiError(meta.errors.noSuchList); - } - - await UserLists.delete(userList.id); + if (userList == null) { + throw new ApiError(meta.errors.noSuchList); } + + await UserLists.delete(userList.id); });