Skip to content

Commit

Permalink
fix(landing): fix contact function
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Aug 21, 2023
1 parent 64bdde6 commit 5f3e8b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion landing/pages/api/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ const contactForm = async (req, res) => {
return res.redirect(302, `/result?variant=contact-error&reason=${message}`)
}

const endpoint = new URL(serviceURL)
const {username, password} = endpoint
endpoint.username = ''
endpoint.password = ''

const form = new URLSearchParams()
form.append('subject', '[readflow-contact] ' + subject)
form.append('to', contactMail)
form.append('from', from)
form.append('text', body)
const resp = await fetch(serviceURL, {
const resp = await fetch(endpoint, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Basic ${btoa(username + ':' + password)}`,
}),
body: form
})
Expand Down

0 comments on commit 5f3e8b7

Please sign in to comment.