refactor: add an error message when deleting a model (#369)

This commit is contained in:
ayangweb
2025-05-24 21:11:06 +08:00
committed by GitHub
parent e8ddee37a0
commit 76e47148d7

View File

@@ -14,17 +14,21 @@ import { join } from '@/utils/path'
const modelStore = useModelStore()
async function handleDelete(item: Model) {
const { id, path } = item
try {
const { id, path } = item
await remove(path, { recursive: true })
await remove(path, { recursive: true })
modelStore.models = modelStore.models.filter(item => item.id !== id)
modelStore.models = modelStore.models.filter(item => item.id !== id)
if (id === modelStore.currentModel?.id) {
modelStore.currentModel = modelStore.models[0]
if (id === modelStore.currentModel?.id) {
modelStore.currentModel = modelStore.models[0]
}
message.success('删除成功')
} catch (error) {
message.error(String(error))
}
message.success('删除成功')
}
</script>