type Acumbamail = {
authToken: string
}
export async function main(
resource: Acumbamail,
body: {
name: string
sender_email: string
company?: string
country?: string
city?: string
address?: string
phone?: string
}
) {
const endpoint = 'https://acumbamail.com/api/1/createList/'
const formData = new FormData()
formData.append('auth_token', resource.authToken)
formData.append('name', body.name)
formData.append('sender_email', body.sender_email)
formData.append('company', body.company ?? '')
formData.append('country', body.country ?? '')
formData.append('city', body.city ?? '')
formData.append('address', body.address ?? '')
formData.append('phone', body.phone ?? '')
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Cache-Control': 'no-cache'
},
body: formData
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 41 days ago