'use client' import { useState } from 'react' import { useToast } from '@/components/ui/toast' import { requestAndDownloadDataExport, DataExportTimeoutError } from '@/utils/dataExportFlow' export default function ExportDataPage() { const { showToast } = useToast() const [exporting, setExporting] = useState(false) const handleExport = async () => { setExporting(true) try { await requestAndDownloadDataExport((phase) => { if (phase === 'processing') showToast('Preparing your export… this can take a couple of minutes.', 'info') }) showToast('Your data export downloaded successfully.', 'success') } catch (error) { console.error('Export data error:', error) showToast( error instanceof DataExportTimeoutError ? 'Still preparing your export. Please check back in a few minutes.' : 'Failed to export data', 'error', ) } finally { setExporting(false) } } return (
Download a copy of all your data including posts, reels, messages, and account information.