<template>
  <div id="app">
    <navbar />
    <section class="container">
      <div class="columns is-centered">
        <router-view />
      </div>
    </section>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import Navbar from "@/components/Navbar.vue";
import { user } from "@/api";

@Component({ components: { Navbar } })
export default class App extends Vue {
  public async created(): Promise<void> {
    if (!user.isAuthenticated && this.$route.name !== "login") {
      this.$router.push({ name: "login" });
    }
  }
}
</script>
