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
+6 -1
View File
@@ -7,6 +7,7 @@ import { FormInput } from "@/components/shared/form-input"
import { FormButton } from "@/components/shared/form-button"
import { QuestionEditor } from "@/components/forms/question-editor"
import { useAuth } from "@/app/context/auth-context"
import { useToast } from "@/app/context/toast-context"
import { getFormById, updateForm } from "@/lib/api"
import type { CreateQuestion } from "@/lib/types"
@@ -15,6 +16,7 @@ const TYPES_WITH_OPTIONS = ["multiple_choice", "checkbox", "dropdown"]
export default function EditFormPage() {
const { id } = useParams()
const { user, loading: authLoading } = useAuth()
const { success, error: showError } = useToast()
const navigate = useNavigate()
const [title, setTitle] = useState("")
@@ -101,9 +103,12 @@ export default function EditFormPage() {
description: description.trim(),
questions,
})
success("Form updated successfully!")
navigate(`/form/${id}`)
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to update form.")
const msg = err instanceof Error ? err.message : "Failed to update form."
showError(msg)
setError(msg)
} finally {
setSubmitting(false)
}