<template>
  <component :is="currentView"></component>
</template>

<script>
import { defineAsyncComponent } from 'vue';
import { mapGetters } from 'vuex';

const HomeNoLoginView = defineAsyncComponent(() => import('./home/NoLoginView.vue'));
const HomeLoggedInView = defineAsyncComponent(() => import('./home/LoggedInView.vue'));

export default {
  name: 'HomeView',
  components: {
    HomeNoLoginView,
    HomeLoggedInView
  },
  computed: {
    ...mapGetters(['isLoggedIn']),
    currentView() {
      return this.isLoggedIn ? 'HomeLoggedInView' : 'HomeNoLoginView';
    }
  }
};
</script>
