Skip to content

Commit e475f68

Browse files
Merge pull request #540 from smartlab-br/539-adjusting-bug-mail
Adjusting bug mail
2 parents 1783712 + 8a9f4b1 commit e475f68

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

layouts/default.vue

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,28 +1339,20 @@ export default {
13391339
if (this.$refs.bugForm.validate()) {
13401340
this.sendingMail = true
13411341
1342-
const content = 'Smartlab - Relate um problema' +
1343-
'\nObservatório: ' + this.computedTitle +
1344-
'\nDimensão: ' + this.computedSubtitle +
1345-
'\nLocalidade: ' + this.computedPlaceTitle +
1346-
'\nCard: ' + this.bugCard +
1347-
'\nDescrição do problema: ' + this.$refs.bugText.value +
1348-
'\nE-mail contato: ' + this.$refs.bugEmail.value
1342+
const contentArgs = {
1343+
args: this.$refs.bugEmail.value +
1344+
'|' + this.computedTitle +
1345+
'|' + this.computedSubtitle +
1346+
'|' + this.computedPlaceTitle +
1347+
'|' + this.bugCard +
1348+
'|' + this.$refs.bugText.value
1349+
}
13491350
13501351
const snackAlert = this.snackAlert
13511352
const finishMailSend = () => { this.sendingMail = false }
13521353
const closeBugDialog = () => { this.bugDialog = false }
13531354
1354-
this.$axios(this.$axiosCallSetupService.getAxiosOptions(
1355-
'/mail', true,
1356-
{
1357-
mail: {
1358-
sistema: 'smartlab',
1359-
recipients: ['atena@mpt.mp.br'],
1360-
subject: 'Smartlab - Relate um problema',
1361-
content
1362-
}
1363-
})
1355+
this.$axios(this.$axiosCallSetupService.getAxiosOptions('/mail', true, contentArgs)
13641356
).then(function (response) {
13651357
finishMailSend()
13661358
snackAlert({ color: 'success', text: 'Formulário enviado com sucesso.' })

server-middleware/api.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ app.post('/mail', (req, res) => {
5757
}
5858

5959
const apiUrl = mercurio.url + req.url
60+
const contentArgs = req.body.args.split('|')
61+
const content = 'Smartlab - Relate um problema' +
62+
'\n E-mail contato: ' + contentArgs[0] +
63+
'\n Observatório: ' + contentArgs[1] +
64+
'\n Dimensão: ' + contentArgs[2] +
65+
'\n Localidade: ' + contentArgs[3] +
66+
'\n Card: ' + contentArgs[4] +
67+
'\n Descrição do problema: ' + contentArgs[5]
6068

6169
const header = {
6270
'Content-Type': 'application/json',
@@ -65,7 +73,14 @@ app.post('/mail', (req, res) => {
6573
axios({
6674
method: 'POST',
6775
url: apiUrl,
68-
data: req.body,
76+
data: {
77+
mail: {
78+
sistema: 'smartlab',
79+
recipients: process.env.MAILER_RECIPIENTS.split(','),
80+
subject: 'Smartlab - Relate um problema',
81+
content
82+
}
83+
},
6984
headers: header
7085
}).then(function (response) {
7186
res.json(response.data)

0 commit comments

Comments
 (0)