<script>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
export default {
  data() {
    return {
      showMenu: null
    }
  },
  computed: {
    loggedIn() {
      return this.$store.state.Session.Token;
    }
  },
  methods: {
    logout () {
      this.$store.dispatch("logout");
    }
  },
  beforeCreate () {
    this.$store.commit("initializeStore");
  }
}
</script>

<template>
  <v-app>
    <v-app-bar app>
      <ul>
        <li v-if="!loggedIn"><router-link to="/login">Login</router-link></li>
        <li v-if="loggedIn"><a @click="logout">Logout</a></li>
        <li v-if="loggedIn"><router-link to="/">Dashboard</router-link></li>
      </ul>
    </v-app-bar>

    <v-navigation-drawer app v-model="showMenu">
      <router-view name="sidebar"></router-view>
    </v-navigation-drawer>
  
    <v-main>
      <router-view></router-view>
    </v-main>
  </v-app>
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
