0👍
Thanks to @CherryDT, I was able to realize I needed to use includes as part of the if statement. The code should look as follows
methods: {
joinRoom(room) {
if (!this.$store.state.rooms.joinedRooms.includes(room)) {
this.$store.dispatch(RoomTypes.JOIN_ROOM, room);
this.$store.dispatch(RoomTypes.CURRENT_ROOM, room);
this.$emit('onClose')
}
else if (this.$store.state.rooms.joinedRooms.includes(room)) {
this.$store.dispatch(RoomTypes.CURRENT_ROOM, room);
this.$emit('onClose')
}
}
},
Source:stackexchange.com