fix(medusa-plugin-economic,medusa-plugin-mailchimp,medusa-plugin-restock-notification,medusa-plugin-sendgrid,medusa-plugin-wishlist): Temporarily remove payload validation in some plugins (#3763)
* Temporarily remove payload validation in some plugins * Add changeset * chore: Remove commented out code * Revert discount generator plugin --------- Co-authored-by: olivermrbl <oliver@mrbltech.com> Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
olivermrbl
Oliver Windall Juhl
parent
282e239dfc
commit
4104d9ccb2
@@ -1,28 +1,10 @@
|
||||
import { Validator, MedusaError } from "medusa-core-utils"
|
||||
|
||||
export default async (req, res) => {
|
||||
const schema = Validator.object().keys({
|
||||
template_id: Validator.string().required(),
|
||||
from: Validator.string().required(),
|
||||
to: Validator.string().required(),
|
||||
data: Validator.object().optional().default({}),
|
||||
})
|
||||
|
||||
const { value, error } = schema.validate(req.body)
|
||||
if (error) {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const sendgridService = req.scope.resolve("sendgridService")
|
||||
await sendgridService.sendEmail(
|
||||
value.template_id,
|
||||
value.from,
|
||||
value.to,
|
||||
value.data
|
||||
)
|
||||
res.sendStatus(200)
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
const sendgridService = req.scope.resolve("sendgridService")
|
||||
await sendgridService.sendEmail(
|
||||
req.body.template_id,
|
||||
req.body.from,
|
||||
req.body.to,
|
||||
req.body.data || {}
|
||||
)
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user