Skip to content

Commit

Permalink
Fix rename
Browse files Browse the repository at this point in the history
  • Loading branch information
weitheng01 committed Jan 28, 2025
1 parent 3cdc125 commit ff55faf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions web/src/pages/FaceLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,15 @@ export default function FaceLibrary() {
await axios.post(`/faces/${renameData.newName}`, formData);
}

await axios.post(`/faces/${renameData.oldName}/delete`, {
ids: oldFaceImages
});
if (oldFaceImages.length > 0) {
await axios.post(`/faces/${renameData.oldName}/delete`, {
ids: oldFaceImages
});
} else {
await axios.post(`/faces/${renameData.oldName}/delete`, {
ids: ['dummy'] // Send a dummy ID to pass validation
});
}

setRenameDialog(false);
setRenameData({ oldName: '', newName: '' });
Expand Down

0 comments on commit ff55faf

Please sign in to comment.