1 | |
2 | type Motimate = { |
3 | token: string |
4 | } |
5 |
|
6 | export async function main(auth: Motimate, user_position_id: string) { |
7 | const url = new URL(`https://motimateapp.com/public_api/user_positions/${user_position_id}`) |
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 |
|