<template>
  <div>
    <SupportView v-if="view === VIEWS.SUPPORT"></SupportView>
  </div>
</template>

<script>

import SupportView from './SupportView.vue';

const VIEWS = {
  SUPPORT: 'support'
};

export default {
  name: 'Index',
  components: {
    SupportView
  },
  data() {
    return {
      VIEWS,
      accessToken: localStorage.token,
      view: ''
    };
  },
  methods: {
  },
  async mounted() {
    if (!localStorage.token) {
      console.error('Set localStorage.token');
      return;
    }

    const that = this;
    function onHashChange() {
      const view = location.hash.slice(2);

      if (view === VIEWS.SUPPORT) {
        that.view = VIEWS.SUPPORT;
      } else {
        that.view = '';
      }
    }

    window.addEventListener('hashchange', onHashChange);
    onHashChange();

    console.log('Indexvue mounted')
  }
};

</script>

<style>

</style>
