From d7ba0a2b65dcc71872351a4d24242da55b1173fc Mon Sep 17 00:00:00 2001 From: Michal Masrna Date: Sat, 11 Nov 2023 19:14:07 +0100 Subject: [PATCH] Register to semester dialog refactor --- src/components/Problems/Problems.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Problems/Problems.tsx b/src/components/Problems/Problems.tsx index 1c013973..c3409167 100644 --- a/src/components/Problems/Problems.tsx +++ b/src/components/Problems/Problems.tsx @@ -184,22 +184,22 @@ export const Problems: FC = () => { const {hasPermissions, permissionsIsLoading} = useHasPermissions() - const [deleteDialogId, setDeleteDialogId] = useState() - const close = () => setDeleteDialogId(undefined) + const [displayRegisterDialog, setDisplayRegisterDialog] = useState(false) + const closeRegisterDialog = () => setDisplayRegisterDialog(false) const editProfile = () => { - close() + closeRegisterDialog() router.push(`/${seminar}/profil/uprava`) } const agree = () => { - deleteDialogId !== undefined && registerToSemester(semesterId) - close() + displayRegisterDialog && registerToSemester(semesterId) + closeRegisterDialog() } return ( <> { canRegister={canRegister} canSubmit={canSubmit} invalidateSeriesQuery={invalidateSeriesQuery} - displayRegisterDialog={() => setDeleteDialogId(problem.id)} + displayRegisterDialog={() => setDisplayRegisterDialog(true)} /> ))}