Closed silverbackdan closed 1 year ago
As a side note, I also thought it'd be good to have a way in which we can implement the middleware with customisations. SO perhaps a way to disable the route and use the middleware still. This is because I want to use recaptcha as well. Looking into how I'm going to impliement this now, and perhaps I can just override the server route manually. I'll see.
@silverbackdan Should be fixed. Can you provide an example for your suggestion and open a new issue?
That's great thanks. For full type definitions if wanted I ended up with something like this for the plugin
import { createError, defineEventHandler, readBody } from "h3";
import nodemailer from "nodemailer";
import options from "#mail/options.js";
import send from "#mail/send.js";
// @ts-ignore
import omit from "@dword-design/functions/dist/omit.js";
const transport = nodemailer.createTransport(options.smtp);
export default defineEventHandler(async (event) => {
try {
await send(await readBody(event), options, transport);
} catch (error) {
if (error instanceof Error) {
throw createError({ statusCode: 500, statusMessage: error.message });
}
throw createError({
statusCode: 500,
statusMessage: "An unknown error occurred",
});
}
return "ok";
});
I'll open a new issue for discussion on the other suggestion
Glad to take a PR with typings for Typescript!
Great, I'll try and spare some time to help contribute. Helpful package, thanks for your work and fast responses.
Just a curious one, is there a reason why you use @dword-design/functions/dist/omit.js
instead of lodash? Is the functionality different?
@silverbackdan I started @dword-design/functions
as a collection of useful functions but most of them are around lodash, so actually there is no big reason anymore to have it. Maybe I'll drop it soon.
Cool, thanks for clarifying :)
Hi and thanks for your great work. I had the issue described here: https://github.com/dword-design/nuxt-mail/issues/137
Setting the type to module in the package.json does work, however I get a warning that the plugin with legacy Nuxt 2 format is likely to be broken in future and should be updated.
I think perhaps a new version will be required for Nuxt 3 to get around these issues and implement the module in a way to future proof it for a while longer.
Were you aware of this and are there plans to make these changes?