feat: introduce vue-email for templating with tailwind (#4358)

* feat: start on vue-email set up

* feat: email rendering and base template

* refactor: body slot only

* feat: templates

* fix: lint

* fix: build process

* fix: default import issue

* feat: continue making emails

* feat: update address

* feat: new templates

* feat: email temp page viewer

* fix: lint

* fix: reset password heading

* fix: lint

* fix: qa issues
This commit is contained in:
Calum H.
2025-09-16 16:57:34 +01:00
committed by GitHub
parent 902d749293
commit 8149618187
29 changed files with 1729 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
import { render } from '@vue-email/render'
import type { Component } from 'vue'
import emails from '~/emails'
export default defineEventHandler(async (event) => {
const template = event.context.params?.template as string
try {
const component = (await emails[template]()).default as Component | undefined
if (!component) {
throw createError({
statusCode: 404,
message: 'Email template not found',
})
}
const html = await render(component, {})
return html
} catch (error) {
console.error(`Error rendering email template ${template}:`, error)
throw createError({
statusCode: 500,
message: 'Failed to render email template',
})
}
})