mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
feat: added error message at submit button
This commit is contained in:
parent
6df7fdf1ab
commit
eaedd77cfd
@ -32,6 +32,7 @@ const Captcha = dynamic(() => import('@components/Captcha'))
|
|||||||
const AddBot:NextPage<AddBotProps> = ({ logged, user, csrfToken, theme }) => {
|
const AddBot:NextPage<AddBotProps> = ({ logged, user, csrfToken, theme }) => {
|
||||||
const [ data, setData ] = useState<ResponseProps<SubmittedBot>>(null)
|
const [ data, setData ] = useState<ResponseProps<SubmittedBot>>(null)
|
||||||
const [ captcha, setCaptcha ] = useState(false)
|
const [ captcha, setCaptcha ] = useState(false)
|
||||||
|
const [ touchedSumbit, setTouched ] = useState(false)
|
||||||
const captchaRef = useRef<HCaptcha>()
|
const captchaRef = useRef<HCaptcha>()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const initialValues: AddBotSubmit = {
|
const initialValues: AddBotSubmit = {
|
||||||
@ -183,13 +184,19 @@ const AddBot:NextPage<AddBotProps> = ({ logged, user, csrfToken, theme }) => {
|
|||||||
window.scrollTo({ top: 0 })
|
window.scrollTo({ top: 0 })
|
||||||
setCaptcha(false)
|
setCaptcha(false)
|
||||||
captchaRef?.current?.resetCaptcha()
|
captchaRef?.current?.resetCaptcha()
|
||||||
}} /> : <Button type='submit' onClick={() => {
|
}} /> : <>
|
||||||
if(!isValid) window.scrollTo({ top: 0 })
|
{
|
||||||
} }>
|
touchedSumbit && !isValid && <div className='my-1 text-red-500 text-xs font-light'>누락되거나 잘못된 항목이 있습니다. 다시 확인해주세요.</div>
|
||||||
<>
|
}
|
||||||
<i className='far fa-paper-plane'/> 제출
|
<Button type='submit' onClick={() => {
|
||||||
</>
|
setTouched(true)
|
||||||
</Button>
|
if(!isValid) window.scrollTo({ top: 0 })
|
||||||
|
} }>
|
||||||
|
<>
|
||||||
|
<i className='far fa-paper-plane'/> 제출
|
||||||
|
</>
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user