delete user invite

Script windmill Verified

by admin ยท 8/13/2023

The script

Submitted by admin Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * delete user invite
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  body: {
8
    email: string;
9
    is_admin: boolean;
10
    operator: boolean;
11
    [k: string]: unknown;
12
  }
13
) {
14
  const url = new URL(
15
    `${BASE_URL}/api/w/${workspace}/workspaces/delete_invite`
16
  );
17

18
  const response = await fetch(url, {
19
    method: "POST",
20
    headers: {
21
      "Content-Type": "application/json",
22
      Authorization: "Bearer " + WM_TOKEN,
23
    },
24
    body: JSON.stringify(body),
25
  });
26
  if (!response.ok) {
27
    const text = await response.text();
28
    throw new Error(`${response.status} ${text}`);
29
  }
30
  return await response.text();
31
}
32