const deleteTeam = async (teamId, accessToken) => {
try {
const response = await fetch(`https://api.weir.ai/org/team/${teamId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${accessToken}`,
'x-source': 'console'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Delete team error:', error);
throw error;
}
};
// Usage with confirmation
if (confirm('Are you sure you want to delete this team?')) {
await deleteTeam('team_123456789', 'your_access_token');
console.log('Team deleted successfully');
}