Skip to content

Commit 34c0c6e

Browse files
fix: Bug removed
Found a bug where mapstate was commented where it was needed to work for identification
1 parent 7ef75ac commit 34c0c6e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

Diff for: src/store/pnp.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ const mutations = {
141141
},
142142
[REMOTE_PEER_ID_CHANGED] (state, newRemotePeerId) {
143143
state.edgeRoom = newRemotePeerId
144-
console.log(state)
144+
state.remotePeerId = null
145+
window.localStorage.removeItem(`${STORAGE_KEY}.remotePeerId`)
145146
}
146147
}
147148

@@ -154,6 +155,7 @@ const mutations = {
154155
*/
155156
async function discoverRemotePeerId ({ peer, state, commit }) {
156157
// first see if we got a remote Edge ID entered to connect to
158+
console.log(state)
157159
if (state.edgeRoom !== undefined) {
158160
return state.edgeRoom
159161
}
@@ -493,7 +495,6 @@ const actions = {
493495
// console.debug('peerFetch.get returned response', { request2, response2 })
494496
},
495497
async [CHANGE_REMOTE_PEER_ID] ({ state, commit, dispatch }, sendEdgeAddress) {
496-
console.log(sendEdgeAddress)
497498
commit(REMOTE_PEER_ID_CHANGED, sendEdgeAddress)
498499
dispatch(PEER_DISCOVER)
499500
},

Diff for: src/views/Settings.vue

+12-10
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
<script>
225225
import AmbBanner from '../components/shared/Banner.vue'
226226
import AmbListItem from '@/components/shared/ListItem.vue'
227-
import { mapActions } from 'vuex'
227+
import { mapActions, mapState } from 'vuex'
228228
import {
229229
PEER_DISCONNECTED,
230230
PEER_DISCOVERING,
@@ -235,6 +235,7 @@ import {
235235
PEER_CONNECTION_ERROR
236236
} from '@/store/mutation-types'
237237
import {
238+
REMOVE_REMOTE_PEER_ID,
238239
CHANGE_REMOTE_PEER_ID
239240
} from '../store/action-types.js'
240241
@@ -268,9 +269,11 @@ export default {
268269
'CHANGE_REMOTE_PEER_ID'
269270
]),
270271
sendEdgeAddress () {
272+
this.$store.dispatch(REMOVE_REMOTE_PEER_ID)
271273
this.$store.dispatch(CHANGE_REMOTE_PEER_ID, this.edgeAddress)
272274
},
273275
localEdgeAddress () {
276+
this.$store.dispatch(REMOVE_REMOTE_PEER_ID)
274277
this.edgeAddress = undefined
275278
this.$store.dispatch(CHANGE_REMOTE_PEER_ID, this.edgeAddress)
276279
}
@@ -280,15 +283,14 @@ export default {
280283
console.log('this.$store.state.pnp.peerConnectionStatus', this.$store.state.pnp.peerConnectionStatus)
281284
return this.$store.state.pnp.peerConnectionStatus === PEER_CONNECTION_ERROR
282285
},
283-
// ...mapState({
284-
// peerConnectionStatus: state => state.pnp.peerConnectionStatus,
285-
// // map this.edgeConnected to this.$store.state.edgeConnected
286-
// isEdgeConnected: state =>
287-
// state.pnp.peerConnectionStatus === PEER_CONNECTED,
288-
// edgePeerId: state => state.pnp.remotePeerId,
289-
// peerFetch: state => state.pnp.peerFetch,
290-
// version: state => state.version
291-
// }),
286+
...mapState({
287+
peerConnectionStatus: state => state.pnp.peerConnectionStatus,
288+
isEdgeConnected: state =>
289+
state.pnp.peerConnectionStatus === PEER_CONNECTED,
290+
edgePeerId: state => state.pnp.remotePeerId,
291+
peerFetch: state => state.pnp.peerFetch,
292+
version: state => state.version
293+
}),
292294
connectStep: function () {
293295
let step = 1
294296
switch (this.peerConnectionStatus) {

0 commit comments

Comments
 (0)