Skip to content

Commit

Permalink
Prefix protocol to lms url when missing, show success msg on success …
Browse files Browse the repository at this point in the history
…only.
  • Loading branch information
srobotta committed Sep 20, 2024
1 parent bc1e25b commit 262348f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ export const SendToMoodle: FC<SendToMoodleProps> = ({
})

const handleOnSendToMoodleClick = () => {
const site = form.values.site
if (site?.trim() !== '' && site?.substring(0, 4).toLowerCase() !== 'http') {
form.setFieldValue('site', `https://${site}`)
}
if (form.isValid) {
form.submitForm()
setIsAddingToMoodleLms(false)
setShouldShowSendToMoodleLmsError(false)
showSendSuccess()
} else {
setShouldShowSendToMoodleLmsError(true)
}
Expand Down Expand Up @@ -94,15 +99,13 @@ export const SendToMoodle: FC<SendToMoodleProps> = ({
<PrimaryButton
onClick={() => {
handleOnSendToMoodleClick()
showSendSuccess()
}}
>
Send
</PrimaryButton>
}
onPressEnter={() => {
handleOnSendToMoodleClick()
showSendSuccess()
}}
onClose={() => {
setIsAddingToMoodleLms(false)
Expand Down

0 comments on commit 262348f

Please sign in to comment.