Feedback form: load categories from the BFF

The form offers the admin-managed categories, falling back to the original
four if they can't be loaded. "My feedback" shows the server's labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gosangam
2026-10-18 13:47:09 +05:30
co-authored by Claude Opus 5.5
parent 0a23ab59f7
commit 52cd48b12e
3 changed files with 61 additions and 16 deletions
+15 -1
View File
@@ -212,6 +212,8 @@ export type Feedback = {
id: string;
user_id?: string;
category: string;
/** The category's current display name (renames apply to past feedback). */
category_label?: string;
message: string;
contact_email?: string;
created_at: string;
@@ -560,13 +562,25 @@ export const collections = {
// ─── Feedback ────────────────────────────────────────────────────────────
/** One option on the /feedback form, managed from the admin panel. */
export type FeedbackCategory = {
key: string;
label: string;
description: string;
};
export const feedback = {
/** The form's categories, in order. Public. */
categories() {
return call<FeedbackCategory[]>("/feedback/categories");
},
/** Submit a /feedback page entry. When the viewer is signed in the
* BFF captures their user_id automatically via the auth cookie —
* the form doesn't ask for it. `contact_email` is required only
* for anonymous submissions; the BFF re-enforces that on its end. */
submit(input: {
category: "bug" | "feature" | "general" | "other";
/** A FeedbackCategory key. */
category: string;
message: string;
contact_email?: string;
}) {