(fileId)
| 143 | |
| 144 | // Deletes a file |
| 145 | export const deleteFile = async (fileId) => { |
| 146 | console.log(`Deleting file with ID: ${fileId}...`); |
| 147 | const response = await fetch(`/api/deleteFile`, { |
| 148 | method: 'DELETE', |
| 149 | headers: { 'Content-Type': 'application/json' }, |
| 150 | body: JSON.stringify({ fileId }), |
| 151 | }); |
| 152 | if (!response.ok) { |
| 153 | console.error('File deletion failed with status:', response.status); |
| 154 | throw new Error('File deletion failed'); |
| 155 | } |
| 156 | const jsonResponse = await response.json(); |
| 157 | console.log('Server response:', jsonResponse); |
| 158 | console.log('File deleted successfully'); |
| 159 | return jsonResponse.deleted; |
| 160 | }; |
no outgoing calls
no test coverage detected