From cbaafcf4c66f30ea9f30a54931cf2627788d045a Mon Sep 17 00:00:00 2001 From: Jason Woodland Date: Wed, 1 Jun 2022 11:08:22 +1000 Subject: [PATCH] fix: enum type --- components/views/media/actions/Actions.vue | 4 +--- components/views/navigation/sidebar/controls/Controls.vue | 5 +++-- store/webrtc/types.ts | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/components/views/media/actions/Actions.vue b/components/views/media/actions/Actions.vue index 1f72465f54..6a9333c87f 100644 --- a/components/views/media/actions/Actions.vue +++ b/components/views/media/actions/Actions.vue @@ -14,10 +14,8 @@ import { } from 'satellite-lucide-icons' import { mapState } from 'vuex' -import { Sounds } from '~/libraries/SoundManager/SoundManager' import { WebRTCEnum } from '~/libraries/Enums/enums' import { Peer2Peer } from '~/libraries/WebRTC/Libp2p' -import { PeerMutedState } from '~/store/webrtc/types' const p2p = Peer2Peer.getInstance() export default Vue.extend({ @@ -53,7 +51,7 @@ export default Vue.extend({ * @description Toggles mute for outgoing audio * @example */ - async toggleMute(kind: keyof PeerMutedState) { + async toggleMute(kind: WebRTCEnum) { this.isLoading = true try { if (kind === WebRTCEnum.AUDIO) { diff --git a/components/views/navigation/sidebar/controls/Controls.vue b/components/views/navigation/sidebar/controls/Controls.vue index 67199c8c6d..50898c7e17 100644 --- a/components/views/navigation/sidebar/controls/Controls.vue +++ b/components/views/navigation/sidebar/controls/Controls.vue @@ -15,6 +15,7 @@ import { import { mapState } from 'vuex' import { Peer2Peer } from '~/libraries/WebRTC/Libp2p' import { PeerMutedState } from '~/store/webrtc/types' +import { WebRTCEnum } from '~/libraries/Enums/enums' const p2p = Peer2Peer.getInstance() export default Vue.extend({ @@ -55,9 +56,9 @@ export default Vue.extend({ async toggleMute(kind: keyof PeerMutedState) { this.isLoading = true try { - if (kind === 'audio') { + if (kind === WebRTCEnum.AUDIO) { this.$store.dispatch('audio/toggleMute', undefined, { root: true }) - } else if (kind === 'video' && this.inCall) { + } else if (kind === WebRTCEnum.VIDEO && this.inCall) { this.$store.dispatch('video/toggleMute', undefined, { root: true }) } } catch (e: any) { diff --git a/store/webrtc/types.ts b/store/webrtc/types.ts index 560684517c..32c847c6bb 100644 --- a/store/webrtc/types.ts +++ b/store/webrtc/types.ts @@ -1,7 +1,7 @@ +import { WebRTCEnum } from '~/libraries/Enums/enums' + export type PeerMutedState = { - audio: boolean - video: boolean - screen: boolean + [key in WebRTCEnum]: boolean } export type StreamMutedState = { [key: string]: PeerMutedState