<template>
  <v-container>
    <v-flex mb-4>
      <h1 class="display-2 font-weight-bold mb-3">
        Hello World!
      </h1>
      <p class="subheading font-weight-regular">
        App under development, please don't submit any valuable data!
      </p>
    </v-flex>

    <LoginForm />
    <RegisterForm />
  </v-container>
</template>

<script>
import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios'

import LoginForm from '@/components/forms/Login.vue'
import RegisterForm from '@/components/forms/Register.vue'

export default {
  name: 'Home',

  data() {
    return {
      dialog: false
    }
  },

  components: {
    LoginForm,
    RegisterForm
  },

  mounted() {
    if (Cookies.get('session')) {
      axios
        .post('/user/login', {
          session: Cookies.get('session')
        })
        .then(response => {
          if (response.data.success) {
            this.$router.push({ name: 'about' })
          }
        })
    }
  }
}
</script>
