'use client' import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { triggerManualBackup } from '@/app/actions/data'; // Import the server action import { Loader2 } from 'lucide-react'; // For loading indicator export default function DebugBackupPage() { const [isLoading, setIsLoading] = useState(false); const [statusMessage, setStatusMessage] = useState(''); const [isError, setIsError] = useState(false); const handleBackupClick = async () => { setIsLoading(true); setStatusMessage('Starting backup...'); setIsError(false); try { const result = await triggerManualBackup(); setStatusMessage(result.message); setIsError(!result.success); } catch (error) { console.error("Error calling triggerManualBackup action:", error); setStatusMessage(`Client-side error: ${error instanceof Error ? error.message : 'Unknown error'}`); setIsError(true); } finally { setIsLoading(false); } }; return (
Click the button below to manually trigger the data backup process. Check the server console logs for detailed output. Backups are stored in the `/backups` directory.
{statusMessage && (