feat: alert on folder exist

This commit is contained in:
Methapon2001 2023-12-13 11:07:48 +07:00
parent 720f8e645a
commit 1ee0520505
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -357,7 +357,17 @@ const useStorage = defineStore('storageStore', () => {
async function createFolder(name: string, path: string = currentInfo.path) {
loader.show()
await api.post(constructUrl(path, true), { name })
if (
folder.value[consistantPath(path)]?.findIndex((v) => v.name === name) !==
-1
) {
error.set({
title: 'แจ้งเตือน',
msg: `พบชื่อ \"${name}\" ซ้ำในระบบ`,
})
} else {
await api.post(constructUrl(path, true), { name })
}
loader.hide()
}
async function editFolder(name: string, path: string) {