From b83d2356e52445669c0acb986aba16082e222222 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:26:11 +0700 Subject: [PATCH] fix: socket event --- .../src/modules/01_user/components/SearchBar.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Services/client/src/modules/01_user/components/SearchBar.vue b/Services/client/src/modules/01_user/components/SearchBar.vue index d78ed1f..33f6623 100644 --- a/Services/client/src/modules/01_user/components/SearchBar.vue +++ b/Services/client/src/modules/01_user/components/SearchBar.vue @@ -43,15 +43,12 @@ const props = defineProps<{ }>() const socket = io(import.meta.env.VITE_API_HOST) -socket.on('FileUpdate', (data: StorageFile) => - replaceSearchItem(data.pathname, data), -) -socket.on('FileUpload', (data: StorageFile) => - replaceSearchItem(data.pathname, data), -) -socket.on('FileUpdateMove', (data: { from: StorageFile; to: StorageFile }) => - replaceSearchItem(data.from.pathname, data.to), -) +socket.on('FileUpload', (data: StorageFile) => { + replaceSearchItem(data.pathname, data) +}) +socket.on('FileMove', (data: { from: StorageFile; to: StorageFile }) => { + replaceSearchItem(data.from.pathname, data.to) +}) function replaceSearchItem(pathname: string, data: StorageFile) { const idx = foundFile.value.findIndex((v) => v.pathname === pathname)