fix(sign): allow sumit without selectedMark
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 42s

This commit is contained in:
enes 2024-12-23 17:45:13 +01:00
parent 92f23bab91
commit cb0d2dd7bc

View File

@ -101,21 +101,22 @@ const PdfMarking = (props: PdfMarkingProps) => {
*/ */
const handleSubmit = (event: React.MouseEvent<HTMLButtonElement>) => { const handleSubmit = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault() event.preventDefault()
if (!selectedMarkValue || !selectedMark) return if (selectedMarkValue && selectedMark) {
const updatedMark: CurrentUserMark = getUpdatedMark(
selectedMark,
selectedMarkValue
)
const updatedMark: CurrentUserMark = getUpdatedMark( setSelectedMarkValue(EMPTY)
selectedMark, const updatedCurrentUserMarks = updateCurrentUserMarks(
selectedMarkValue currentUserMarks,
) updatedMark
)
setCurrentUserMarks(updatedCurrentUserMarks)
setSelectedMark(null)
setUpdatedMarks(updatedMark.mark)
}
setSelectedMarkValue(EMPTY)
const updatedCurrentUserMarks = updateCurrentUserMarks(
currentUserMarks,
updatedMark
)
setCurrentUserMarks(updatedCurrentUserMarks)
setSelectedMark(null)
setUpdatedMarks(updatedMark.mark)
handleSign() handleSign()
} }
@ -162,16 +163,14 @@ const PdfMarking = (props: PdfMarkingProps) => {
otherUserMarks={otherUserMarks} otherUserMarks={otherUserMarks}
/> />
</StickySideColumns> </StickySideColumns>
{selectedMark !== null && ( <MarkFormField
<MarkFormField handleSubmit={handleSubmit}
handleSubmit={handleSubmit} handleSelectedMarkValueChange={handleChange}
handleSelectedMarkValueChange={handleChange} selectedMark={selectedMark}
selectedMark={selectedMark} selectedMarkValue={selectedMarkValue}
selectedMarkValue={selectedMarkValue} currentUserMarks={currentUserMarks}
currentUserMarks={currentUserMarks} handleCurrentUserMarkChange={handleCurrentUserMarkChange}
handleCurrentUserMarkChange={handleCurrentUserMarkChange} />
/>
)}
</Container> </Container>
</> </>
) )