From 1ee05205057cb51bcd2b4de50ef67e5ec1e98dc9 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:07:48 +0700 Subject: [PATCH] feat: alert on folder exist --- Services/client/src/stores/storage.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Services/client/src/stores/storage.ts b/Services/client/src/stores/storage.ts index 9e1367c..3059a98 100644 --- a/Services/client/src/stores/storage.ts +++ b/Services/client/src/stores/storage.ts @@ -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) {