test #101
@@ -94,9 +94,16 @@ export default {
|
||||
this.isLoading = true
|
||||
try {
|
||||
let res = await api.getMenus();
|
||||
if (res.status === 200 && res.data.success === true && res.data.data.length > 0) {
|
||||
this.items = res.data.data
|
||||
if (res.status === 200 && res.data.success === true) {
|
||||
// 기본 메뉴 설정 (API 결과가 비어있을 수 있음)
|
||||
this.items = Array.isArray(res.data.data) ? res.data.data : []
|
||||
|
||||
// 현재 사용자 역할 확인
|
||||
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|
||||
|| localStorage.role
|
||||
|
||||
// ADMIN 권한 전용 추가 메뉴들
|
||||
if (role === 'ADMIN') {
|
||||
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
|
||||
try {
|
||||
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
|
||||
@@ -173,7 +180,7 @@ export default {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// 정산현황 메뉴에 '채널 후원 정산' 추가
|
||||
// 정산현황 메뉴에 '채널 후원 정산' 및 '오리지널 시리즈 정산' 추가
|
||||
try {
|
||||
const calculateMenu = this.items.find(m => m && m.title === '정산현황')
|
||||
if (calculateMenu) {
|
||||
@@ -189,7 +196,6 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
// '오리지널 시리즈 정산' 추가
|
||||
const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series')
|
||||
if (!existsOriginal) {
|
||||
calculateMenu.items.push({
|
||||
@@ -202,6 +208,22 @@ export default {
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// 조회한 메뉴가 비어 있고, 콘텐츠 매니저라면 기본 메뉴 추가
|
||||
if (this.items.length === 0 && role === 'CONTENT_MANAGER') {
|
||||
this.items.push({
|
||||
title: '콘텐츠 리스트',
|
||||
route: '/content/list',
|
||||
items: null
|
||||
})
|
||||
}
|
||||
|
||||
// 그래도 비어있다면 이전 동작과 동일하게 처리
|
||||
if (this.items.length === 0) {
|
||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||
this.logout();
|
||||
}
|
||||
} else {
|
||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||
this.logout();
|
||||
|
||||
Reference in New Issue
Block a user