<template>
  <div id="map">
    <node-map class="node-map" v-if="data" v-bind="one" />
    <node-map
      class="node-map" v-if="data2" v-bind="two"
      id="ùmqsldùml"
    />
  </div>
</template>

<script>
import { toSingleManyData, toManyManyData } from '@/helpers/d3Data'
import NodeMap from '@/components/NodeMap'

export default {
  name: 'Home',

  components: {
    NodeMap
  },

  data () {
    return {
      id: 39,
      data: null,
      data2: null,
      one: { nodes: null, links: null },
      two: { nodes: null, links: null }
    }
  },

  created () {
    this.$store.dispatch('GET_TREE', this.id).then((data) => {
      this.data = data
      this.one = toSingleManyData(data)
    })
    this.$store.dispatch('GET_TREE', this.id).then((data) => {
      this.data2 = data
      this.two = toManyManyData(data)
    })
  }
}
</script>

<style lang="scss" scoped>
#map {
  height: 100%;
  width: 100%;
  display: flex;
  flex-basis: 50%;
}
.node-map {
  width: 50vw;
}
</style>
