fix: socket CreateFolder folder doubly

This commit is contained in:
somnetsak123 2023-12-12 15:03:46 +07:00
parent 456c00a5bd
commit b30e4ebba4

View file

@ -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)