Skip to content

Commit

Permalink
Update superforms imports and types in sendFeedbackToEmail route
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardspresume committed Mar 5, 2024
1 parent a3824e4 commit d8016b7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/routes/sendFeedbackToEmail/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import type { Actions } from './$types';

import nodemailer from 'nodemailer';

import { message, superValidate } from 'sveltekit-superforms/server';
import { zod } from 'sveltekit-superforms/adapters';
import {
message,
superValidate,
type Infer,
type SuperValidated
} from 'sveltekit-superforms/server';

import type { AlertMessageType } from '$lib/types';

Expand Down Expand Up @@ -40,11 +46,16 @@ async function sendEmail(mailOptions: object) {
return emailTransporter.sendMail(mailOptions);
}

type FeedbackFormValidateType = SuperValidated<
Infer<FeedbackValidationSchemaType>,
AlertMessageType
>;

export const actions: Actions = {
default: async ({ request }) => {
const feedbackForm = await superValidate<FeedbackValidationSchemaType, AlertMessageType>(
const feedbackForm: FeedbackFormValidateType = await superValidate(
request,
FeedbackValidationSchema
zod(FeedbackValidationSchema)
);

if (!feedbackForm.valid) {
Expand Down

0 comments on commit d8016b7

Please sign in to comment.