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)} /> ))}