0
Register new user
One script reply has been approved by the moderators Verified
Created by hugo697 2 days ago Viewed 0 times
0
Submitted by hugo697 Bun
Verified 2 days ago
1
//native
2
type Actimo = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	auth: Actimo,
8
	body: {
9
		company?: string
10
		country_code?: string
11
		email?: string
12
		phone_number?: string
13
	}
14
) {
15
	const url = new URL(`https://actimo.com/api/v1/account/register`)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			'Content-Type': 'application/json'
21
		},
22
		body: JSON.stringify(body)
23
	})
24

25
	if (!response.ok) {
26
		const text = await response.text()
27
		throw new Error(`${response.status} ${text}`)
28
	}
29

30
	return await response.json()
31
}
32