diff --git a/app/components/forms/NotificationGroup.tsx b/app/components/forms/NotificationGroup.tsx index 94cd23f..e88620d 100644 --- a/app/components/forms/NotificationGroup.tsx +++ b/app/components/forms/NotificationGroup.tsx @@ -163,7 +163,6 @@ const NotificationGroup = ({ }); }, }} - errors={fields.name.errors} /> Delivery format @@ -187,9 +186,6 @@ const NotificationGroup = ({ Email RSS - {fields.format.errors && ( - - )} Filters @@ -233,11 +229,6 @@ const NotificationGroup = ({ - {fields.queries.errors && ( - - - - )} {(testFetcher.data || testFetcher.data === 0) && ( @@ -289,7 +280,11 @@ const NotificationGroup = ({ lastResult?.initialValue.id === group.id && ( - Your notification settings have been saved. + {lastResult?.status === "success" ? ( + Your notification settings have been saved. + ) : ( + Error: this notification group already exists + )} )} diff --git a/app/routes/notifications/index.tsx b/app/routes/notifications/index.tsx index e7a7f3d..8a00a5a 100644 --- a/app/routes/notifications/index.tsx +++ b/app/routes/notifications/index.tsx @@ -60,6 +60,7 @@ export const action = async ({ request }: Route.ActionArgs) => { code: z.ZodIssueCode.custom, message: "At least one query item is required", }); + return; } const existingGroups = await db.query.notificationGroup.findMany({ @@ -69,10 +70,10 @@ export const action = async ({ request }: Route.ActionArgs) => { for (const group of existingGroups) { if (group.name === data.name && group.id !== data.id) { ctx.addIssue({ - path: ["name"], code: z.ZodIssueCode.custom, message: "A group with this name already exists", }); + return; } if ( @@ -80,16 +81,18 @@ export const action = async ({ request }: Route.ActionArgs) => { group.id !== data.id ) { ctx.addIssue({ - path: ["queries"], code: z.ZodIssueCode.custom, message: "A group with these queries already exists", }); + return; } } }), async: true, }); + console.log(submission.status); + if (submission.status !== "success") { return data( { result: submission.reply() },