diff --git a/prod.log b/prod.log
new file mode 100644
index 00000000..d592674e
--- /dev/null
+++ b/prod.log
@@ -0,0 +1,8 @@
+
+> start
+> next start
+
+▲ Next.js 16.2.9
+- Local: http://localhost:3000
+- Network: http://5.252.100.130:3000
+✓ Ready in 93ms
diff --git a/src/actions/admin-help.ts b/src/actions/admin-help.ts
index d5ed50b2..89254c06 100644
--- a/src/actions/admin-help.ts
+++ b/src/actions/admin-help.ts
@@ -48,11 +48,12 @@ export async function createHelpQuestion(formData: FormData): Promise {
targetType: "help_center_category",
targetId: Number(entry.id),
});
- } catch {
- // Unique name collision or DB error — re-render unchanged.
+ } catch (error) {
+ // Unique name collision or DB error — re-render unchanged with error.
revalidatePath("/admin/help-questions");
- return;
+ redirect("/admin/help-questions/new?error=Unique name collision or database error. Please try again.");
}
+ revalidatePath("/admin/help-questions");
redirect("/admin/help-questions");
}
diff --git a/src/app/admin/help-questions/[id]/page.tsx b/src/app/admin/help-questions/[id]/page.tsx
index e94ed7cd..571c477d 100644
--- a/src/app/admin/help-questions/[id]/page.tsx
+++ b/src/app/admin/help-questions/[id]/page.tsx
@@ -7,10 +7,13 @@ export const dynamic = "force-dynamic";
export default async function EditHelpQuestion({
params,
+ searchParams,
}: {
params: Promise<{ id: string }>;
+ searchParams: Promise<{ error?: string }>;
}) {
const { id } = await params;
+ const { error } = await searchParams;
let entry: Awaited<
ReturnType
> = null;
@@ -29,6 +32,11 @@ export default async function EditHelpQuestion({
← Help Center
Edit help-center entry
+ {error ? (
+
+ Error: {error}
+
+ ) : null}