0

Delete User Avatar

by
Published Nov 5, 2024

Deletes a UserAvatar.

Script motimate Verified

The script

Submitted by hugo697 Bun
Verified 581 days ago
1
//native
2
type Motimate = {
3
	token: string
4
}
5

6
export async function main(auth: Motimate, user_id: string) {
7
	const url = new URL(`https://motimateapp.com/public_api/users/${user_id}/avatar`)
8

9
	const response = await fetch(url, {
10
		method: 'DELETE',
11
		headers: {
12
			Authorization: 'Bearer ' + auth.token
13
		}
14
	})
15

16
	if (!response.ok) {
17
		const text = await response.text()
18
		throw new Error(`${response.status} ${text}`)
19
	}
20

21
	return await response.text()
22
}
23