"use client"; import { useParams, useRouter } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; import { api } from "@/lib/api/client"; import type { components } from "@/lib/api/schema"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; type Person = components["schemas"]["PersonRead"]; export default function RecoveryPage() { const router = useRouter(); const params = useParams<{ id: string }>(); const treeId = params.id; const [people, setPeople] = useState([]); const [ready, setReady] = useState(false); const load = useCallback(async () => { const { data, response } = await api.GET("/api/v1/trees/{tree_id}/persons", { params: { path: { tree_id: treeId }, query: { deleted: true } }, }); if (response.status === 401) { router.push("/login"); return; } setPeople(data ?? []); setReady(true); }, [router, treeId]); useEffect(() => { load(); }, [load]); async function restore(id: string) { await api.POST("/api/v1/trees/{tree_id}/persons/{person_id}/restore", { params: { path: { tree_id: treeId, person_id: id } }, }); load(); } if (!ready) return

Loading…

; return (

Recently deleted

Deleted people are recoverable for 30 days, then permanently purged.

{people.length === 0 ? (

Nothing here.

) : ( )}
); }