<template>
    <div class="m-2">
        <div class="flex-between">
            <h1 class="mb-3">Administration</h1>
            <a href="#" @click.prevent="logout" class="btn btn-icon">
                <svg-vue icon="logout" /> Déconnexion
            </a>
        </div>
        <UserAdmin />
    </div>
</template>

<script>
    import UserAdmin from "./User/UserAdmin";

    export default {
        name: "DashBoard",
        components: {
            UserAdmin
        },
        methods: {
            logout: function () {
                axios.post('logout')
                    .then(res => {
                        if(res.status ===302 || 401) {
                            window.location.href = '/login'
                        }
                    }).catch(error => {

                })
            }
        }
    }
</script>
