mirror of
https://github.com/SrIzan10/helium.git
synced 2026-06-06 00:56:58 +00:00
30 lines
787 B
TypeScript
30 lines
787 B
TypeScript
import { defineStore} from 'pinia';
|
|
|
|
export const useViewerStore = defineStore('viewer', {
|
|
state: () => ({
|
|
code: '',
|
|
peerConnection: null as RTCPeerConnection | null,
|
|
connectionStatus: 'waiting for a code',
|
|
isDisconnected: false,
|
|
}),
|
|
actions: {
|
|
setCode(code: string) {
|
|
this.code = code;
|
|
},
|
|
setPeerConnection(pc: RTCPeerConnection | null) {
|
|
this.peerConnection = pc;
|
|
},
|
|
setConnectionStatus(status: string) {
|
|
if (process.env.NODE_ENV === 'development') {
|
|
console.log('pinia connection status debug:', status);
|
|
}
|
|
this.connectionStatus = status;
|
|
if (status === 'disconnected') {
|
|
this.isDisconnected = true;
|
|
}
|
|
},
|
|
resetDisconnected() {
|
|
this.isDisconnected = false;
|
|
}
|
|
},
|
|
}); |