Leeren Modell-Unterordner automatisch löschen
This commit is contained in:
@@ -472,7 +472,13 @@ export default function Kalkulator3D({ toast, editData, onEditDone, mobile, setA
|
|||||||
<button onClick={async () => {
|
<button onClick={async () => {
|
||||||
try {
|
try {
|
||||||
await api(`/tools/dateien/${f.id}`, { method:'DELETE' });
|
await api(`/tools/dateien/${f.id}`, { method:'DELETE' });
|
||||||
setExistingFiles(p => p.filter(x => x.id !== f.id));
|
const remaining = existingFiles.filter(x => x.id !== f.id);
|
||||||
|
setExistingFiles(remaining);
|
||||||
|
// Ordner löschen wenn er jetzt leer ist
|
||||||
|
if (remaining.length === 0 && modelFolderId) {
|
||||||
|
await api(`/tools/dateien/folders/${modelFolderId}`, { method:'DELETE' });
|
||||||
|
setModelFolderId(null);
|
||||||
|
}
|
||||||
} catch(e) { toast(e.message, 'error'); }
|
} catch(e) { toast(e.message, 'error'); }
|
||||||
}} style={{ background:'transparent', border:'none', cursor:'pointer',
|
}} style={{ background:'transparent', border:'none', cursor:'pointer',
|
||||||
color:'rgba(255,107,157,0.5)', fontSize:14, padding:'0 2px', flexShrink:0, lineHeight:1 }}>✕</button>
|
color:'rgba(255,107,157,0.5)', fontSize:14, padding:'0 2px', flexShrink:0, lineHeight:1 }}>✕</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user