Skip to content

Commit

Permalink
fix: enum type
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwoodland committed Jun 1, 2022
1 parent e69a888 commit b1b1a92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 1 addition & 3 deletions components/views/media/actions/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -53,7 +51,7 @@ export default Vue.extend({
* @description Toggles mute for outgoing audio
* @example
*/
toggleMute(kind: keyof PeerMutedState) {
toggleMute(kind: WebRTCEnum) {
this.isLoading = true
if (kind === WebRTCEnum.AUDIO) {
this.$store.dispatch('audio/toggleMute', undefined, { root: true })
Expand Down
5 changes: 3 additions & 2 deletions components/views/navigation/sidebar/controls/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -54,9 +55,9 @@ export default Vue.extend({
*/
async toggleMute(kind: keyof PeerMutedState) {
this.isLoading = true
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 })
}
this.isLoading = false
Expand Down
6 changes: 3 additions & 3 deletions store/webrtc/types.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit b1b1a92

Please sign in to comment.