exists workspace

Script windmill Verified

by admin ยท 8/13/2023

The script

Submitted by admin Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * exists workspace
3
 *
4
 */
5
export async function main(body: { id: string; [k: string]: unknown }) {
6
  const url = new URL(`${BASE_URL}/api/workspaces/exists`);
7

8
  const response = await fetch(url, {
9
    method: "POST",
10
    headers: {
11
      "Content-Type": "application/json",
12
      Authorization: "Bearer " + WM_TOKEN,
13
    },
14
    body: JSON.stringify(body),
15
  });
16
  if (!response.ok) {
17
    const text = await response.text();
18
    throw new Error(`${response.status} ${text}`);
19
  }
20
  return await response.text();
21
}
22