import { save } from "../../resources/api/cntnStats" export default { methods: { // 권한 검증 isValidRole() { const roles = this.$store.state.roles; if(!Array.isArray(roles)) { return false; } for(const role of roles) { if(typeof role !== 'object' || !role.hasOwnProperty('authority')) { return false; } } return true; }, // 접속 통계 등록 async cntnStatsSave(menuId) { const roleChck = this.isValidRole(); if(!roleChck) { alert('접근이 불가합니다.\n관리자에게 문의하세요.'); this.$router.push({ path: '/' }); } try { const mbrAuth = this.$store.state.roles.map(auth => auth.authority); // 사용자 권한 정보 const cntnStats = { 'typeId': menuId, 'mbrAuthList' : mbrAuth } await save(cntnStats); } catch(error) { console.log(error); } }, } }