( response: Response, fallbackMessage: string )
| 319 | } |
| 320 | |
| 321 | async function parseUploadResponse( |
| 322 | response: Response, |
| 323 | fallbackMessage: string |
| 324 | ): Promise<UploadFileResponse> { |
| 325 | let data: { success?: boolean; error?: string; file?: UserFile } | null = null |
| 326 | try { |
| 327 | data = await response.json() |
| 328 | } catch {} |
| 329 | |
| 330 | if (!response.ok || !data?.success) { |
| 331 | throw new Error(data?.error || `${fallbackMessage} (${response.status})`) |
| 332 | } |
| 333 | return data as UploadFileResponse |
| 334 | } |
| 335 | |
| 336 | async function uploadWorkspaceFile( |
| 337 | workspaceId: string, |
no outgoing calls
no test coverage detected