From b3a1d25e04866eb4b90c8d506b30af83f5aca74f 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 384b7d713..5a7613c98 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); });