<template>
  <div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <div class="row">
      <div class="offset-1 col-md-10">
        <ListView :items="items" :editable="true" @onEdit="onEdit" />
      </div>
    </div>
  </div>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import log from '../../assets/Log';
import ListView from '../shared/listView.vue';

export default {
  components: {
    ListView,
  },
  data() {
    return {
      user: JSON.parse(log.getUser()),
    };
  },
  mounted() {
    console.log(this.user.id);
    this.getItems(this.user.id);
  },
  computed: {
    ...mapState('myWeeks', ['items']),
  },
  methods: {
    ...mapActions('myWeeks', ['getItems']),
    onEdit(item) {
      this.$router.push(`/timeshare/${item.id}`);
    },
  },
};
</script>
