1 | type Acumbamail = { |
2 | authToken: string |
3 | } |
4 |
|
5 | export async function main(resource: Acumbamail, list_id: number, subscriber_email: string) { |
6 | const endpoint = `https://acumbamail.com/api/1/unsubscribeSubscriber/` |
7 |
|
8 | const formData = new FormData() |
9 |
|
10 | formData.append('auth_token', resource.authToken) |
11 | formData.append('list_id', list_id.toString()) |
12 | formData.append('email', subscriber_email) |
13 |
|
14 | const response = await fetch(endpoint, { |
15 | method: 'POST', |
16 | headers: { |
17 | 'Cache-Control': 'no-cache' |
18 | }, |
19 | body: formData |
20 | }) |
21 |
|
22 | if (!response.ok) { |
23 | throw new Error(`HTTP error! status: ${response.status}`) |
24 | } |
25 |
|
26 | return { success: true } |
27 | } |
28 |
|