Skip to content

Commit

Permalink
fix: Bug in disconnecting / connecting
Browse files Browse the repository at this point in the history
Bug found when doing a production build for dockerfying UI.
This was because peerConnectionStatus
wasn't updated as it should be.
  • Loading branch information
BKristenssonAlfsson committed May 24, 2020
1 parent 43c03ec commit c4d27a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/store/pnp.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,18 @@ const actions = {
// console.debug('peerFetch.get returned response', { request, response, text2 })
// console.debug('peerFetch.get returned response', { request2, response2 })
},
async [CHANGE_REMOTE_PEER_ID] ({ state, commit, dispatch }, sendEdgeAddress) {
commit(REMOTE_PEER_ID_CHANGED, sendEdgeAddress)
/**
* @param {*} edgeAddress The Edge PeerJS address that UI will connect too
* Update Edge Address for the remote Ambianic Edge you want to connect to
* Perhaps your parents are isolated, then it would be nixe to connect to
* them or let them connect to you.
* When connecting to a remote network, edgeAddress will be the PeerJS ID
* from the remote Edge, and when connecting back to local network, it will be
* undefined.
*/
async [CHANGE_REMOTE_PEER_ID] ({ state, commit, dispatch }, edgeAddress) {
commit(REMOTE_PEER_ID_CHANGED, edgeAddress)
commit(PEER_DISCONNECTED)
dispatch(PEER_DISCOVER)
},
/**
Expand Down
3 changes: 0 additions & 3 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ import {
PEER_CONNECTION_ERROR
} from '@/store/mutation-types'
import {
REMOVE_REMOTE_PEER_ID,
CHANGE_REMOTE_PEER_ID
} from '../store/action-types.js'
Expand Down Expand Up @@ -268,11 +267,9 @@ export default {
'CHANGE_REMOTE_PEER_ID'
]),
sendEdgeAddress () {
this.$store.dispatch(REMOVE_REMOTE_PEER_ID)
this.$store.dispatch(CHANGE_REMOTE_PEER_ID, this.edgeAddress)
},
localEdgeAddress () {
this.$store.dispatch(REMOVE_REMOTE_PEER_ID)
this.edgeAddress = undefined
this.$store.dispatch(CHANGE_REMOTE_PEER_ID, this.edgeAddress)
}
Expand Down

0 comments on commit c4d27a0

Please sign in to comment.