feat: add toast
Docker Build and Push / build-and-push (push) Successful in 6m54s

This commit is contained in:
2026-03-01 21:55:00 +07:00
parent d339f41ced
commit 190486fad0
8 changed files with 171 additions and 7 deletions
+4 -1
View File
@@ -17,12 +17,14 @@ import { FormButton } from "@/components/shared/form-button"
import { QuestionPreview } from "@/components/forms/question-preview"
import { getFormById, deleteForm } from "@/lib/api"
import { useAuth } from "@/app/context/auth-context"
import { useToast } from "@/app/context/toast-context"
import type { FormDetail } from "@/lib/types"
export default function FormPreviewPage() {
const { id } = useParams()
const navigate = useNavigate()
const { user } = useAuth()
const { success, error: showError } = useToast()
const [form, setForm] = useState<FormDetail | null>(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
@@ -57,9 +59,10 @@ export default function FormPreviewPage() {
setDeleting(true)
try {
await deleteForm(id)
success("Form deleted successfully.")
navigate("/forms")
} catch {
setError("Failed to delete form.")
showError("Failed to delete form.")
setShowDeleteConfirm(false)
} finally {
setDeleting(false)