Онлайн правое меню

This commit is contained in:
iriska-gri committed 2024-01-23 10:54:51 +03:00
1 parent 3e9d7272e0
commit 5a664524d8
1 file changed
+26 -18
+26 -18
View File
@@ -4,7 +4,8 @@
variant="text" variant="text"
v-for="x in onlineuser" v-for="x in onlineuser"
:key="x" :key="x"
class="my-1"
height="50"
> >
<v-avatar <v-avatar
size="36px" size="36px"
@@ -32,6 +33,7 @@ import {checkremote} from '@/utils/universal_functions'
import InfoUserCard from './UI/infoUserCard.vue' import InfoUserCard from './UI/infoUserCard.vue'
export default { export default {
components: { InfoUserCard}, components: { InfoUserCard},
setup(){ setup(){
@@ -45,29 +47,35 @@ export default {
}} }}
const accountStore = useAccountStore() const accountStore = useAccountStore()
let onlineuser= ref([]) let onlineuser= ref([])
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
const whatuser=(x)=> {
loging.value = x
open.value = true
}
const whatuser=(x)=> { connect.onmessage=(e)=>{
loging.value = x let data = JSON.parse(e.data)
open.value = true wsfuncs[data['message']['action']](data.message.data)
} }
connect.onmessage=(e)=>{ watch(()=>accountStore.cod2user,function(){
let data = JSON.parse(e.data) if (!accountStore.cod2user.value){
wsfuncs[data['message']['action']](data.message.data) connect.close()
} }
watch(()=>accountStore.cod2user,function(){
if (!accountStore.cod2user.value){
connect.close()
}
}) })
return {
loging,
return {loging,open, onlineuser, checkremote,spravURL, whatuser, accountStore} open,
onlineuser,
checkremote,
spravURL,
whatuser,
accountStore
} }
}
} }
</script> </script>