mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
improve var naming a bit
This commit is contained in:
@@ -19,18 +19,18 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
const {
|
const {
|
||||||
query: { template: templateArg },
|
query: { template: templateArg },
|
||||||
} = req
|
} = req
|
||||||
const options = req.body
|
const templateData = req.body
|
||||||
const templateName = Array.isArray(templateArg) ? templateArg[0] : templateArg
|
const templateName = Array.isArray(templateArg) ? templateArg[0] : templateArg
|
||||||
const template = TEMPLATES[templateName]
|
const template = TEMPLATES[templateName]
|
||||||
|
|
||||||
if (!template) {
|
if (!template) {
|
||||||
res.status(404).json({ statusCode: 404, message: 'Template not specified availabe' })
|
res.status(404).json({ statusCode: 404, message: 'Template not specified' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const texDoc = template(options)
|
const texDoc = template(templateData)
|
||||||
const id = await renderer(texDoc)
|
const id = await renderer(texDoc)
|
||||||
const storeData = Object.assign({}, options, {
|
const storeData = Object.assign({}, templateData, {
|
||||||
id,
|
id,
|
||||||
created: new Date().toISOString(),
|
created: new Date().toISOString(),
|
||||||
template: templateName,
|
template: templateName,
|
||||||
|
|||||||
Reference in New Issue
Block a user