admin: Superforms + Zod validation, three-address-defaults schema, profiles toast fix
- Add Superforms + Zod 4 for all admin form validation - Replace address isDefault with three separate boolean defaults (Mailing, Billing, Shipping) - Update profiles page with three-checkbox address form and toast improvements - Convert all admin page server actions to pass request directly to crud - Export superFormErrorsToFieldErrors helper for profiles server actions - Regenerate Prisma client for new schema fields
This commit is contained in:
+11
-11
@@ -2,11 +2,11 @@
|
||||
* AUTHOR: Neil Clack
|
||||
* EMAIL: nclack@radiantwavetech.com
|
||||
* DATE: 07/06/2027
|
||||
*
|
||||
*
|
||||
* An example endpoint, temporarily enabled, to describe
|
||||
* how to send an email with the Resend API and our custom
|
||||
* how to send an email with the Resend API and our custom
|
||||
* sendMail function.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { json } from '@sveltejs/kit';
|
||||
@@ -14,12 +14,12 @@ import { sendMail } from '$lib/server/resend';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
export const POST: RequestHandler = async ({ request }) => {
|
||||
const { to, subject, templateId, data } = await request.json();
|
||||
const { to, subject, templateId, data } = await request.json();
|
||||
|
||||
try {
|
||||
const result = await sendMail({ to, subject, templateId, data });
|
||||
return json(result);
|
||||
} catch (e) {
|
||||
return json({ error: (e as Error).message }, { status: 400 });
|
||||
}
|
||||
};
|
||||
try {
|
||||
const result = await sendMail({ to, subject, templateId, data });
|
||||
return json(result);
|
||||
} catch (e) {
|
||||
return json({ error: (e as Error).message }, { status: 400 });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user