Niche API Documentation - v0.1.0
    Preparing search index...

    Function submitSurvey

    • Saves the user's onboarding survey answers to survey_responses.

      Validates the submitted form data against SurveyAnswersSchema before writing. Duplicate submissions (Postgres error 23505) are silently ignored — the user is simply forwarded to /results. On any other DB error the action returns an error message so the form can try again.

      Parameters

      • _prev: SurveyFormState

        Previous form state (unused; required by useActionState).

      • formData: FormData

        Survey answers keyed by question ID.

      Returns Promise<SurveyFormState>

      SurveyFormState with error and submitted on failure, or redirects to /results.