Skip to content

Instantly share code, notes, and snippets.

@numfin
Created July 12, 2018 14:07
Show Gist options
  • Save numfin/72cac57b88f859d1640ada459ebea83b to your computer and use it in GitHub Desktop.
Save numfin/72cac57b88f859d1640ada459ebea83b to your computer and use it in GitHub Desktop.
switchToChannel({state, commit, dispatch}, channelID) {
const exists = this.selectByKey(state.channels, {key: '_id', value: channelID})
if (exists) {
Object.keys(channels).forEach(key => {
const id = channels[key]._id
if (id === channelID) {
commit('channel', channels[i])
}
})
} else {
if(!process.env.production) {
console.log('NOT YOUR CHANNEL')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment