(filePath, tag)
| 1418 | |
| 1419 | // Remove a tag from a file |
| 1420 | function removeTagFromFile(filePath, tag) { |
| 1421 | fetch(`/api/tags/${encodeURIComponent(filePath)}`, { |
| 1422 | method: 'DELETE', |
| 1423 | headers: { |
| 1424 | 'Content-Type': 'application/json' |
| 1425 | }, |
| 1426 | body: JSON.stringify({ tags: [tag] }) |
| 1427 | }) |
| 1428 | .then(response => response.json()) |
| 1429 | .then(data => { |
| 1430 | if (data.status === 'success') { |
| 1431 | // Refresh the file if it's currently open |
| 1432 | if (currentFile === filePath) { |
| 1433 | loadFile(filePath); |
| 1434 | } |
| 1435 | |
| 1436 | // Refresh the file list |
| 1437 | loadFiles(); |
| 1438 | |
| 1439 | // Show success message |
| 1440 | showToast(`Tag "${tag}" removed successfully`, 'success'); |
| 1441 | |
| 1442 | // Update tags display |
| 1443 | updateTagsDisplay(); |
| 1444 | } else { |
| 1445 | console.error('Error removing tag:', data.message); |
| 1446 | showToast(`Error removing tag: ${data.message}`, 'error'); |
| 1447 | } |
| 1448 | }) |
| 1449 | .catch(error => { |
| 1450 | console.error('Error removing tag:', error); |
| 1451 | showToast('Error removing tag. Please try again.', 'error'); |
| 1452 | }); |
| 1453 | } |
| 1454 | |
| 1455 | // Delete a category |
| 1456 | function deleteCategory(category) { |
nothing calls this directly
no test coverage detected