mirror of
https://github.com/ayangweb/BongoCat.git
synced 2026-03-12 17:51:48 +08:00
refactor: add an error message when deleting a model (#369)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user