fix: update dependences

This commit is contained in:
2026-03-02 15:51:33 +08:00
parent b40691a4a3
commit 6f205d2408
7 changed files with 1245 additions and 2029 deletions

View File

@@ -1,5 +1,6 @@
import { ref } from "vue";
import { defineStore } from "pinia";
import { connectWebSocket, disconnectWebSocket, sendMessage, setIsManualClose } from '@/websocket/roomSocket'
interface PlayroomState {
id: number
@@ -20,6 +21,14 @@ export const PlayroomStore = defineStore("PlayroomStore",
currentPlayroom.value = playroom;
}
const getCurrentPlayroom = () =>{
return currentPlayroom.value;
}
const getCurrentId = () =>{
return currentPlayroom.value?.r_id;
}
const setCurrentUrl = (url: string) => {
currentUrl.value = url;
}
@@ -30,9 +39,35 @@ export const PlayroomStore = defineStore("PlayroomStore",
}
return {
currentPlayroom,
getCurrentPlayroom,
getCurrentId,
setCurrentPlayroom,
setCurrentUrl,
clearPlayroom,
}
})
})
export const videoSocketStore = defineStore("videoSocketStore",{
state: () => ({
isConnected: false,
hasGotMessage: false,
id: 0
}),
actions: {
connect(id: number) {
this.id = id;
if (this.isConnected === true) return
connectWebSocket();
this.isConnected = true;
},
disconnect() {
setIsManualClose(true);
disconnectWebSocket();
this.isConnected = false;
},
send(message: string) {
sendMessage(JSON.stringify(message));
}
}
})