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

6
export async function main(
7
	auth: Actimo,
8
	keycode: string,
9
	body: { passcode?: string; resetCode?: string }
10
) {
11
	const url = new URL(`https://actimo.com/api/v1/contacts/auth/${keycode}/passcode`)
12

13
	const response = await fetch(url, {
14
		method: 'PUT',
15
		headers: {
16
			'Content-Type': 'application/json'
17
		},
18
		body: JSON.stringify(body)
19
	})
20

21
	if (!response.ok) {
22
		const text = await response.text()
23
		throw new Error(`${response.status} ${text}`)
24
	}
25

26
	return await response.json()
27
}
28