Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Aug 6, 2024
1 parent ae67689 commit fd569a8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/controllers/confirmationController.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import PageController from './pageController.js'
import yaml from 'js-yaml';
import fs from 'fs';
import yaml from 'js-yaml'
import fs from 'fs'

const templateFile = 'src/assets/emailTemplates/newEndpoint.yml'

const templateContent = fs.readFileSync(templateFile, 'utf8');
const template = yaml.load(templateContent);
const templateContent = fs.readFileSync(templateFile, 'utf8')
const template = yaml.load(templateContent)

class confirmationController extends PageController {
locals(req, res, next) {
locals (req, res, next) {
const name = req.sessionModel.get('name')
const email = req.sessionModel.get('email')
const organisation = req.sessionModel.get('lpa')
Expand All @@ -17,9 +17,9 @@ class confirmationController extends PageController {
const endpoint = req.sessionModel.get('endpoint-url')

const recipient = 'digitalland@levellingup.gov.uk'
const templateVars = { name, organisation, email, endpoint, documentationUrl, dataset };
const subject = template.subject.replace(/\${(.*?)}/g, (match, key) => templateVars[key]);
const body = template.body.replace(/\${(.*?)}/g, (match, key) => templateVars[key]);
const templateVars = { name, organisation, email, endpoint, documentationUrl, dataset }
const subject = template.subject.replace(/\${(.*?)}/g, (match, key) => templateVars[key])
const body = template.body.replace(/\${(.*?)}/g, (match, key) => templateVars[key])

req.form.options.mailTo = `mailto:${recipient}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`

Expand Down

0 comments on commit fd569a8

Please sign in to comment.