| 48 | } |
| 49 | |
| 50 | async function createTeam(token: string) { |
| 51 | const res = await prompts({ |
| 52 | type: 'text', |
| 53 | name: 'name', |
| 54 | message: 'Please enter a new team name:', |
| 55 | initial: 'My team', |
| 56 | }) |
| 57 | const response = await fetch(`${APP_URL}/api/teams`, { |
| 58 | method: 'POST', |
| 59 | headers: { |
| 60 | Authorization: `Bearer ${token}`, |
| 61 | 'Content-Type': 'application/json', |
| 62 | Accept: 'application/json', |
| 63 | }, |
| 64 | body: JSON.stringify({ |
| 65 | name: res.name, |
| 66 | }), |
| 67 | }) |
| 68 | return await response.json() |
| 69 | } |
| 70 | |
| 71 | async function createProject(token: string, team: number) { |
| 72 | const res = await prompts({ |