feat: localStorage 문제 해결 및 시스템 개선
- localStorage와 DB ID 불일치 문제 해결 - 프로젝트별 보고서 시간 필터링 수정 - 일반 사용자에게 일일공수 메뉴 숨김 - 공통 헤더 및 인증 시스템 구현 - 프로젝트별 일일공수 분리 기능 추가 (ProjectDailyWork 모델) - IssuesAPI에서 project_id 누락 문제 수정 - 사용자 인증 통합 (TokenManager 기반)
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
<nav class="bg-white border-b">
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex gap-2 py-2 overflow-x-auto">
|
||||
<a href="daily-work.html" class="nav-link">
|
||||
<a href="daily-work.html" class="nav-link" id="dailyWorkBtn" style="display: none;">
|
||||
<i class="fas fa-calendar-check mr-2"></i>일일 공수
|
||||
</a>
|
||||
<a href="index.html" class="nav-link">
|
||||
@@ -187,7 +187,7 @@
|
||||
</main>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="/static/js/api.js?v=20250917"></script>
|
||||
<script src="/static/js/api.js?v=20251024m"></script>
|
||||
<script src="/static/js/date-utils.js?v=20250917"></script>
|
||||
<script>
|
||||
let currentUser = null;
|
||||
@@ -607,28 +607,22 @@
|
||||
|
||||
// 페이지 로드 시 사용자 정보 확인 및 관리자 배너 표시
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const currentUserData = localStorage.getItem('currentUser');
|
||||
if (!currentUserData) {
|
||||
// 메인 페이지와 동일한 방식으로 토큰에서 사용자 정보 가져오기
|
||||
const user = TokenManager.getUser();
|
||||
if (!user) {
|
||||
window.location.href = 'index.html';
|
||||
return;
|
||||
}
|
||||
|
||||
let currentUser;
|
||||
try {
|
||||
// JSON 파싱 시도
|
||||
currentUser = JSON.parse(currentUserData);
|
||||
} catch (e) {
|
||||
// JSON이 아니면 문자열로 처리 (기존 방식 호환)
|
||||
currentUser = { username: currentUserData };
|
||||
}
|
||||
currentUser = user;
|
||||
|
||||
// 사용자 표시
|
||||
const username = currentUser.username || currentUser;
|
||||
const displayName = currentUser.full_name || (username === 'hyungi' ? '관리자' : username);
|
||||
document.getElementById('userDisplay').textContent = `${displayName} (${username})`;
|
||||
const displayName = currentUser.full_name || currentUser.username;
|
||||
document.getElementById('userDisplay').textContent = `${displayName} (${currentUser.username})`;
|
||||
|
||||
// 관리자인 경우 메뉴 표시
|
||||
if (username === 'hyungi' || currentUser.role === 'admin') {
|
||||
if (currentUser.role === 'admin') {
|
||||
document.getElementById('dailyWorkBtn').style.display = '';
|
||||
document.getElementById('listBtn').style.display = '';
|
||||
document.getElementById('summaryBtn').style.display = '';
|
||||
document.getElementById('projectBtn').style.display = '';
|
||||
|
||||
Reference in New Issue
Block a user