Fix: 페이지 간 이동 시 로그아웃 문제 해결 및 기능 개선
- 토큰 저장 키 통일 (access_token으로 일관성 확보) - 일일공수 페이지 API 스크립트 로딩 순서 수정 - 프로젝트 관리 페이지 비활성 프로젝트 표시 문제 해결 - 업로드 카테고리에 '기타' 항목 추가 (백엔드 schemas.py 포함) - 비밀번호 변경 기능 API 연동으로 수정 - 프로젝트 드롭다운 z-index 문제 해결 - CORS 설정 및 Nginx 구성 개선 - 비밀번호 해싱 방식 pbkdf2_sha256으로 변경 (bcrypt 72바이트 제한 해결)
This commit is contained in:
104
frontend/sync-projects-from-db.html
Normal file
104
frontend/sync-projects-from-db.html
Normal file
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>프로젝트 DB → localStorage 동기화</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.status {
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.success { background: #d4edda; color: #155724; }
|
||||
.error { background: #f8d7da; color: #721c24; }
|
||||
.info { background: #d1ecf1; color: #0c5460; }
|
||||
pre { background: #f4f4f4; padding: 10px; overflow-x: auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>프로젝트 DB → localStorage 동기화</h1>
|
||||
|
||||
<div id="status"></div>
|
||||
<pre id="result"></pre>
|
||||
|
||||
<button onclick="syncProjects()">동기화 시작</button>
|
||||
<button onclick="location.href='index.html'">메인으로</button>
|
||||
|
||||
<script>
|
||||
// DB의 프로젝트 데이터 (backend에서 확인한 데이터)
|
||||
const dbProjects = [
|
||||
{
|
||||
id: 1,
|
||||
jobNo: 'TKR-25009R',
|
||||
projectName: 'M Project',
|
||||
isActive: true,
|
||||
createdAt: '2025-10-24T09:49:42.456272+09:00',
|
||||
createdByName: '관리자'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
jobNo: 'TKG-24011P',
|
||||
projectName: 'TKG Project',
|
||||
isActive: true,
|
||||
createdAt: '2025-10-24T10:59:49.71909+09:00',
|
||||
createdByName: '관리자'
|
||||
}
|
||||
];
|
||||
|
||||
function showStatus(message, type = 'info') {
|
||||
const statusDiv = document.getElementById('status');
|
||||
statusDiv.className = 'status ' + type;
|
||||
statusDiv.textContent = message;
|
||||
}
|
||||
|
||||
function syncProjects() {
|
||||
try {
|
||||
// 기존 localStorage 데이터 확인
|
||||
const existing = localStorage.getItem('work-report-projects');
|
||||
if (existing) {
|
||||
showStatus('기존 localStorage 데이터가 있습니다. 덮어쓰시겠습니까?', 'info');
|
||||
if (!confirm('기존 프로젝트 데이터를 DB 데이터로 덮어쓰시겠습니까?')) {
|
||||
showStatus('동기화 취소됨', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// localStorage에 저장
|
||||
localStorage.setItem('work-report-projects', JSON.stringify(dbProjects));
|
||||
|
||||
// 결과 표시
|
||||
document.getElementById('result').textContent = JSON.stringify(dbProjects, null, 2);
|
||||
showStatus('✅ DB 프로젝트 2개를 localStorage로 동기화 완료!', 'success');
|
||||
|
||||
// 2초 후 메인으로 이동
|
||||
setTimeout(() => {
|
||||
alert('동기화가 완료되었습니다. 메인 페이지로 이동합니다.');
|
||||
location.href = 'index.html';
|
||||
}, 2000);
|
||||
|
||||
} catch (error) {
|
||||
showStatus('❌ 동기화 실패: ' + error.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 로드 시 현재 상태 표시
|
||||
window.onload = () => {
|
||||
const current = localStorage.getItem('work-report-projects');
|
||||
if (current) {
|
||||
showStatus('현재 localStorage에 프로젝트 데이터가 있습니다.', 'info');
|
||||
document.getElementById('result').textContent = 'Current: ' + current;
|
||||
} else {
|
||||
showStatus('localStorage에 프로젝트 데이터가 없습니다.', 'info');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user