From b876f140b261885784f444e4ffa091e483b31372 Mon Sep 17 00:00:00 2001 From: Kohminchae <72334086+Kohminchae@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:58:23 +0900 Subject: [PATCH] fix(fe): fix delete problem error (#2247) --- .../admin/problem/_components/ProblemsDeleteButton.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/frontend/app/admin/problem/_components/ProblemsDeleteButton.tsx b/apps/frontend/app/admin/problem/_components/ProblemsDeleteButton.tsx index 70e0d5f65d..7acf2573f3 100644 --- a/apps/frontend/app/admin/problem/_components/ProblemsDeleteButton.tsx +++ b/apps/frontend/app/admin/problem/_components/ProblemsDeleteButton.tsx @@ -21,7 +21,14 @@ export default function ProblemsDeleteButton() { ) const results = await Promise.all(promises) - const isAllSafe = results.every(({ data }) => data === undefined) + const isAllSafe = results.every(({ data }) => { + const contests = data?.getContestsByProblemId + return ( + contests?.finished.length === 0 && + contests.ongoing.length === 0 && + contests.upcoming.length === 0 + ) + }) if (isAllSafe) { return true