diff --git a/frontend/index.html b/frontend/index.html
index 4533065..01a3dcc 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -446,8 +446,24 @@
console.log('π API_BASE_URL:', typeof API_BASE_URL !== 'undefined' ? API_BASE_URL : 'undefined');
console.log('π νμ¬ hostname:', window.location.hostname);
console.log('π νμ¬ protocol:', window.location.protocol);
- // API λ‘λ ν μ΄κΈ°ν μμ
- initializeApp();
+
+ // initializeApp ν¨μκ° μ μλμλμ§ νμΈ
+ if (typeof initializeApp === 'function') {
+ console.log('π initializeApp ν¨μ νΈμΆ μμ');
+ initializeApp();
+ } else {
+ console.error('β initializeApp ν¨μκ° μ μλμ§ μμ');
+ // λμ: μ§μ μ΄κΈ°ν λ‘μ§ μ€ν
+ setTimeout(() => {
+ if (typeof initializeApp === 'function') {
+ console.log('π μ§μ°λ initializeApp ν¨μ νΈμΆ');
+ initializeApp();
+ } else {
+ console.error('β initializeApp ν¨μλ₯Ό μ°Ύμ μ μμ - μλ μ΄κΈ°ν');
+ manualInitialize();
+ }
+ }, 100);
+ }
};
script.setAttribute('cache-control', 'no-cache, no-store, must-revalidate');
script.setAttribute('pragma', 'no-cache');
@@ -472,6 +488,62 @@
let currentPhotos = [];
let issues = [];
+ // μλ μ΄κΈ°ν ν¨μ (initializeApp ν¨μκ° λ‘λλμ§ μμ λ μ¬μ©)
+ async function manualInitialize() {
+ console.log('π§ μλ μ΄κΈ°ν μμ');
+
+ // ν ν°μ΄ μμΌλ©΄ μ¬μ©μ μ 보 κ°μ Έμ€κΈ°
+ const token = localStorage.getItem('access_token');
+ if (token) {
+ try {
+ // ν ν°μΌλ‘ μ¬μ©μ μ 보 κ°μ Έμ€κΈ° (API νΈμΆ)
+ const user = await AuthAPI.getCurrentUser();
+ currentUser = user;
+
+ // localStorageμλ λ°±μ
μ μ₯
+ localStorage.setItem('currentUser', JSON.stringify(user));
+
+ // κ³΅ν΅ ν€λ μ΄κΈ°ν
+ console.log('π§ μλ μ΄κΈ°ν - κ³΅ν΅ ν€λ μ΄κΈ°ν μμ:', user);
+ console.log('window.commonHeader μ‘΄μ¬:', !!window.commonHeader);
+
+ if (window.commonHeader && typeof window.commonHeader.init === 'function') {
+ await window.commonHeader.init(user, 'issues_create');
+ console.log('β
μλ μ΄κΈ°ν - κ³΅ν΅ ν€λ μ΄κΈ°ν μλ£');
+ } else {
+ console.error('β μλ μ΄κΈ°ν - κ³΅ν΅ ν€λ λͺ¨λμ΄ λ‘λλμ§ μμ');
+ }
+
+ // νμ΄μ§ μ κ·Ό κΆν μ²΄ν¬ (λΆμ ν© λ±λ‘ νμ΄μ§)
+ setTimeout(() => {
+ if (typeof canAccessPage === 'function' && !canAccessPage('issues_create')) {
+ alert('λΆμ ν© λ±λ‘ νμ΄μ§μ μ κ·Όν κΆνμ΄ μμ΅λλ€.');
+ window.location.href = '/issue-view.html';
+ return;
+ }
+ }, 500);
+
+ // μ¬μ©μ μ 보λ κ³΅ν΅ ν€λμμ νμλ¨
+ document.getElementById('loginScreen').classList.add('hidden');
+ document.getElementById('mainScreen').classList.remove('hidden');
+
+ // νλ‘μ νΈ λ‘λ
+ await loadProjects();
+
+ loadIssues();
+
+ // URL ν΄μ μ²λ¦¬
+ handleUrlHash();
+
+ } catch (error) {
+ console.error('μλ μ΄κΈ°ν μ€ν¨:', error);
+ // ν ν°μ΄ μ ν¨νμ§ μμΌλ©΄ λ‘κ·Έμμ
+ localStorage.removeItem('access_token');
+ localStorage.removeItem('currentUser');
+ }
+ }
+ }
+
// API λ‘λ ν μ± μ΄κΈ°ν
async function initializeApp() {
console.log('π μ± μ΄κΈ°ν μμ');
@@ -489,8 +561,21 @@
// κ³΅ν΅ ν€λ μ΄κΈ°ν
console.log('π§ κ³΅ν΅ ν€λ μ΄κΈ°ν μμ:', user);
- await window.commonHeader.init(user, 'issues_create');
- console.log('β
κ³΅ν΅ ν€λ μ΄κΈ°ν μλ£');
+ console.log('window.commonHeader μ‘΄μ¬:', !!window.commonHeader);
+
+ if (window.commonHeader && typeof window.commonHeader.init === 'function') {
+ await window.commonHeader.init(user, 'issues_create');
+ console.log('β
κ³΅ν΅ ν€λ μ΄κΈ°ν μλ£');
+ } else {
+ console.error('β κ³΅ν΅ ν€λ λͺ¨λμ΄ λ‘λλμ§ μμ');
+ // λμ: κΈ°λ³Έ μ¬μ©μ μ 보 νμ
+ setTimeout(() => {
+ if (window.commonHeader && typeof window.commonHeader.init === 'function') {
+ console.log('π μ§μ°λ κ³΅ν΅ ν€λ μ΄κΈ°ν');
+ window.commonHeader.init(user, 'issues_create');
+ }
+ }, 200);
+ }
// νμ΄μ§ μ κ·Ό κΆν μ²΄ν¬ (λΆμ ν© λ±λ‘ νμ΄μ§)
setTimeout(() => {