<template>
  <div v-for="(nodes, index) in otherArray" :key="index">
    <p
      class="readmode"
      :id="nodes.node_id"
      :inner-html.prop="nodes.node_text"
    ></p>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'

// import marked from 'marked'

export default {
  name: 'OtherNodes',

  data() {
    return {
      otherArray: [],
    }
  },

  computed: {
    ...mapState({
      otherNodes: (state) => state.otherNodes,
    }),
  },

  // watch: {
  //   added: function () {
  //     this.loadData()
  //   },
  // },

  mounted() {
    //console.log('mounted')
    setTimeout(this.loadData, 500)

    // if (localStorage.nogg_microcosm) {
    //   // var devicename = localStorage.nogg_name
    //   var microcosm = localStorage.nogg_microcosm
    //   this.$store.dispatch('setMicrocosm', { microcosm })
    // } else {
    //   console.log('no')
    //   // go home
    // }
  },

  methods: {
    loadData() {
      var othersFiltered = this.otherNodes.otherNodes.filter(
        (nodes) => nodes.node_deleted == false
      )
      this.$store.dispatch('getOthernodes')
      this.otherArray = othersFiltered
    },
  },
}
</script>

<style scoped></style>