<template>
    <div class="home">
        <page-title pagetitle="Riichi Mahjong"/>
        <form class="home-form" action="#" @submit.prevent="onSubmit">
            <button-text id="login" width="615px" height="130px" text="Se Connecter"/>
            <button-text id="register" width="615px" height="130px" text="S'Enregistrer"/>
        </form>
    </div>
</template>

<script>

import PageTitle from '@/components/PageTitle.vue'
import ButtonText from '../components/ButtonText.vue'
export default {
    name: 'Home',
    components: {
        PageTitle,
        ButtonText
    },
    beforeCreate () {
        if (localStorage.getItem('user') != null) {
            this.$router.push('/lobby');
        }
    },
    methods: {
        onSubmit: function(){
            if (event.submitter.id=='login') {
                this.$router.push('login');
            }
            if (event.submitter.id=='register') {
                this.$router.push('register');
            }
        }
    }
}
</script>

<style>
.home{
    position: relative;
    top: 200px;
    display: flex;
    flex-direction: column;
    
}
.home *{
margin-left:auto;
margin-right:auto;
}

.home-form{
    display: flex;
    flex-direction: column;
}
</style>