<template>
    <header>
        <div class="flex-end">
            <p class="admin-bar">{{ mngrId.mngr_id }} 님</p>
            <button class="logout-bnt" v-show="mngrId.mngr_id != null" @click="logout">로그아웃</button>
        </div>

    </header>
</template>

<script>
import axios from 'axios';

export default {
    props: {
        mngrId: { type: Object }
    },
    data() {
        return {};
    },
    methods: {
        //로그아웃
        logout: function () {
            if (confirm('로그아웃 하시겠습니까?') == false) {
                return;
            }
            let vm = this;
            axios({
                url: "/user/logout.json",
                method: "post",
                headers: {
                    "Content-Type": "application/json; charset=UTF-8",
                },
            }).then(function (response) {
                vm.$emit("updateIsLogin", false);
                vm.$router.push({ path: '/adm/login.page', query: {} });
            }).catch(function (error) {
                console.log("logout - error : ", error);
            });
        },
    },
    watch: {},
    computed: {},
    components: {},
    mounted() {
    },
};
</script>
