From b30e4ebba42798b0b3673c405bee5a3664b23a2a Mon Sep 17 00:00:00 2001 From: somnetsak123 Date: Tue, 12 Dec 2023 15:03:46 +0700 Subject: [PATCH] fix: socket CreateFolder folder doubly --- Services/client/src/stores/storage.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Services/client/src/stores/storage.ts b/Services/client/src/stores/storage.ts index 38b2ed9..faecae2 100644 --- a/Services/client/src/stores/storage.ts +++ b/Services/client/src/stores/storage.ts @@ -204,10 +204,10 @@ const useStorage = defineStore('storageStore', () => { if (folder.value[path]) { const idx = folder.value[path].findIndex( - (v) => v.pathname === currentInfo.path, + (v) => v.pathname === data.pathname, ) - if (idx !== -1) { + if (idx === -1) { folder.value[path].push({ pathname: data.pathname, name: data.name, @@ -285,6 +285,7 @@ const useStorage = defineStore('storageStore', () => { (v) => v.pathname === currentInfo.path, ) console.log(idx) + }) socket.on('FileUpload', (data: StorageFile) => { const arr = data.pathname.split('/').filter(Boolean)