1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-11 16:35:09 +01:00

refs #16 Handle error when could not start user stream

This commit is contained in:
AkiraFukushima 2018-03-13 22:35:04 +09:00
parent 4c227b2dfa
commit 0dc1788a89
2 changed files with 13 additions and 5 deletions

View File

@ -26,6 +26,12 @@ export default {
})
})
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
.catch(() => {
this.$message({
message: 'Could not start user streaming',
type: 'error'
})
})
this.$store.dispatch('TimelineSpace/username', account)
.catch(() => {
this.$message({

View File

@ -69,11 +69,6 @@ const TimelineSpace = {
})
},
startUserStreaming ({ commit }, account) {
ipcRenderer.send('start-user-streaming', account)
ipcRenderer.once('error-start-userstreaming', (event, err) => {
// handle error
console.log(err)
})
ipcRenderer.on('update-start-user-streaming', (event, update) => {
commit('appendHomeTimeline', update)
})
@ -84,6 +79,13 @@ const TimelineSpace = {
}
commit('appendNotifications', notification)
})
return new Promise((resolve, reject) => {
ipcRenderer.send('start-user-streaming', account)
ipcRenderer.once('error-start-userstreaming', (event, err) => {
reject(err)
})
})
},
stopUserStreaming ({ commit }) {
ipcRenderer.send('stop-user-streaming')