fix: socket event
This commit is contained in:
parent
51120ba49b
commit
b83d2356e5
1 changed files with 6 additions and 9 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue