224
224
<script >
225
225
import AmbBanner from ' ../components/shared/Banner.vue'
226
226
import AmbListItem from ' @/components/shared/ListItem.vue'
227
- import { mapActions } from ' vuex'
227
+ import { mapActions , mapState } from ' vuex'
228
228
import {
229
229
PEER_DISCONNECTED ,
230
230
PEER_DISCOVERING ,
@@ -235,6 +235,7 @@ import {
235
235
PEER_CONNECTION_ERROR
236
236
} from ' @/store/mutation-types'
237
237
import {
238
+ REMOVE_REMOTE_PEER_ID ,
238
239
CHANGE_REMOTE_PEER_ID
239
240
} from ' ../store/action-types.js'
240
241
@@ -268,9 +269,11 @@ export default {
268
269
' CHANGE_REMOTE_PEER_ID'
269
270
]),
270
271
sendEdgeAddress () {
272
+ this .$store .dispatch (REMOVE_REMOTE_PEER_ID )
271
273
this .$store .dispatch (CHANGE_REMOTE_PEER_ID , this .edgeAddress )
272
274
},
273
275
localEdgeAddress () {
276
+ this .$store .dispatch (REMOVE_REMOTE_PEER_ID )
274
277
this .edgeAddress = undefined
275
278
this .$store .dispatch (CHANGE_REMOTE_PEER_ID , this .edgeAddress )
276
279
}
@@ -280,15 +283,14 @@ export default {
280
283
console .log (' this.$store.state.pnp.peerConnectionStatus' , this .$store .state .pnp .peerConnectionStatus )
281
284
return this .$store .state .pnp .peerConnectionStatus === PEER_CONNECTION_ERROR
282
285
},
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
+ }),
292
294
connectStep : function () {
293
295
let step = 1
294
296
switch (this .peerConnectionStatus ) {
0 commit comments