Database Yedeği, Uygulama Hata ayıklama
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, forwardRef, useImperativeHandle } from 'react'
|
||||
import { useState, useEffect, forwardRef, useImperativeHandle, useCallback } from 'react'
|
||||
import { getNewCaptcha, CaptchaResponse } from '@/app/actions/captcha'
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
@@ -20,7 +20,7 @@ export const Captcha = forwardRef<CaptchaRef, CaptchaProps>(({ onVerify }, ref)
|
||||
const [input, setInput] = useState("")
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
const fetchCaptcha = async () => {
|
||||
const fetchCaptcha = useCallback(async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const data = await getNewCaptcha()
|
||||
@@ -32,11 +32,11 @@ export const Captcha = forwardRef<CaptchaRef, CaptchaProps>(({ onVerify }, ref)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
}, [onVerify])
|
||||
|
||||
useEffect(() => {
|
||||
fetchCaptcha()
|
||||
}, [])
|
||||
}, [fetchCaptcha])
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
reset: fetchCaptcha
|
||||
|
||||
Reference in New Issue
Block a user