<template>

    <header>
        <div class="header-container w1500">
            <div class="logo-wrap">
                <router-link :to="{ path: '/' }" class="logo"><img :src="logo" alt=""></router-link>
            </div>
            <div class="nav-wrap">
                <nav>
                    <ul>
                        <li>기록물</li>
                        <li>언론에서 바라본 구미시</li>
                        <li>회원관리</li>
                        <li>카테고리 관리</li>
                    </ul>
                </nav>
            </div>
            <div class="auth-area">
                <ul v-if="$store.state.userId != null">
                    <li><img src="../../resources/images/icon/user-settings-line.png" alt="">
                        <router-link :to="{ path: '/MyInfo.page' }">{{ $store.state.userNm }}</router-link>
                    </li>
                    <li>
                        <div class="line"></div>
                    </li>
                    <li><img src="../../resources/images/icon/logout-box-line.png" alt="">
                        <a href="#" @click.prevent="logout">로그아웃</a>
                    </li>
                </ul>
                <a href="#" class="all-menu"><img src="../../resources/images/allmenu.png" alt=""></a>
            </div>
        </div>
    </header>
</template>
<script>
export default {
    data() {
        return {
            // Define the image sources
            logo: 'client/resources/images/logo.png',
        };
    },
    methods: {
        logout() {
            this.$store.commit('setStoreReset'); // 로그아웃 뮤테이션 호출
            this.isUserNm = null; // 사용자 이름 초기화
            this.$router.push({ path: '/Login.page' }); // 로그인 페이지로 리다이렉트
        }
    },
    watch: {},
    computed: {},
    components: {},
    mounted() { },
};
</script>