(userData)
| 184 | } |
| 185 | |
| 186 | async function createUser(userData) { |
| 187 | try { |
| 188 | const response = await fetch('/api/auth/users', { |
| 189 | method: 'POST', |
| 190 | headers: { |
| 191 | 'Content-Type': 'application/json', |
| 192 | ...getAuthHeaders() |
| 193 | }, |
| 194 | body: JSON.stringify(userData) |
| 195 | }) |
| 196 | |
| 197 | if (!response.ok) { |
| 198 | const error = await response.json() |
| 199 | throw new Error(error.detail || '创建用户失败') |
| 200 | } |
| 201 | |
| 202 | return await response.json() |
| 203 | } catch (error) { |
| 204 | console.error('创建用户错误:', error) |
| 205 | throw error |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | async function updateUser(userId, userData) { |
| 210 | try { |
nothing calls this directly
no test coverage detected