Database Yedeği, Uygulama Hata ayıklama

This commit is contained in:
2025-12-29 23:58:50 +03:00
parent 8ba8d2e05e
commit b3bceaaff5
4 changed files with 270 additions and 5 deletions

View File

@@ -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

View File

@@ -45,7 +45,7 @@ export async function checkRateLimit(action: string): Promise<{ blocked: boolean
if (ip === '::1') ip = '127.0.0.1'
// Clean up old limits
const windowStart = new Date(Date.now() - WINDOW_MINUTES * 60 * 1000).toISOString()
// Clean up old limits (logic simplified, variable unused)
// Check current limit
const { data: limit } = await supabase