From 36b6cc9a81955cf34703c23834784d343899d792 Mon Sep 17 00:00:00 2001 From: puri-ph4tt Date: Fri, 15 Dec 2023 14:08:29 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E0=B8=A2=E0=B9=89=E0=B8=B2=E0=B8=A2=20s?= =?UTF-8?q?ocket=20=E0=B9=80=E0=B8=81=E0=B8=B5=E0=B9=88=E0=B8=A2=E0=B8=A7?= =?UTF-8?q?=E0=B8=81=E0=B8=B1=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=84?= =?UTF-8?q?=E0=B9=89=E0=B8=99=E0=B8=AB=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/01_user/components/SearchBar.vue | 31 +------------------ Services/client/src/stores/searched-data.ts | 2 -- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/Services/client/src/modules/01_user/components/SearchBar.vue b/Services/client/src/modules/01_user/components/SearchBar.vue index 33f6623..ec71232 100644 --- a/Services/client/src/modules/01_user/components/SearchBar.vue +++ b/Services/client/src/modules/01_user/components/SearchBar.vue @@ -3,7 +3,6 @@ import { ref, watch } from 'vue' import { storeToRefs } from 'pinia' import axiosClient from '@/services/HttpService' import mime from 'mime' -import io from 'socket.io-client' import type { StorageFile } from '@/stores/storage' import { useSearchDataStore } from '@/stores/searched-data' @@ -15,11 +14,9 @@ import AdvancedSearch from '@/modules/01_user/components/AdvancedSearch.vue' const loaderStore = useLoader() const { isFilePreview } = storeToRefs(useFileInfoStore()) const { - foundFile, isExact, isSearch, isAdvSearchCall, - isActFoundFile, searchData, advSearchDataField, advSearchDataRow, @@ -41,20 +38,6 @@ const submitSearchData = ref<{ const props = defineProps<{ mode: 'admin' | 'user' }>() -const socket = io(import.meta.env.VITE_API_HOST) - -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) - - if (idx !== -1) foundFile.value[idx] = data -} async function submitSearch() { isFilePreview.value = false @@ -136,18 +119,6 @@ async function submitSearch() { } } -watch( - () => isActFoundFile.value, - (edited) => { - if (edited === true) { - submitSearch() - setTimeout(() => { - isActFoundFile.value = false - }, 1000) - } - }, -) - watch( () => searchData.value.value, (search) => { @@ -165,7 +136,7 @@ watch( outlined dense label="ค้นหา" - debounce="500" + debounce="300" bg-color="white" v-model="searchData.value" id="inputSearch" diff --git a/Services/client/src/stores/searched-data.ts b/Services/client/src/stores/searched-data.ts index 7543f2e..125fb32 100644 --- a/Services/client/src/stores/searched-data.ts +++ b/Services/client/src/stores/searched-data.ts @@ -24,7 +24,6 @@ export const useSearchDataStore = defineStore('searched', () => { const isAdvSearchCall = ref(false) const isSearch = ref(false) const isExact = ref(false) - const isActFoundFile = ref(false) const searchData = ref({ field: 'title', value: '', @@ -51,7 +50,6 @@ export const useSearchDataStore = defineStore('searched', () => { isSearch, isExact, isAdvSearchCall, - isActFoundFile, searchData, advSearchDataRow, advSearchDataField,