整合資料庫、完成登入註冊忘記密碼功能
This commit is contained in:
51
scripts/test-admin-fix.js
Normal file
51
scripts/test-admin-fix.js
Normal file
@@ -0,0 +1,51 @@
|
||||
async function testAdminFix() {
|
||||
console.log('🧪 測試管理員存取修復...\n');
|
||||
|
||||
try {
|
||||
// 測試管理員頁面載入
|
||||
console.log('1. 測試管理員頁面載入...');
|
||||
const response = await fetch('http://localhost:3000/admin');
|
||||
|
||||
if (response.ok) {
|
||||
console.log('✅ 管理員頁面載入成功');
|
||||
console.log('狀態碼:', response.status);
|
||||
|
||||
// 檢查頁面內容
|
||||
const pageContent = await response.text();
|
||||
|
||||
if (pageContent.includes('載入中...')) {
|
||||
console.log('✅ 頁面顯示載入中狀態');
|
||||
} else if (pageContent.includes('存取被拒')) {
|
||||
console.log('❌ 頁面顯示存取被拒');
|
||||
|
||||
// 檢查調試信息
|
||||
const debugMatch = pageContent.match(/調試信息: 用戶=([^,]+), 角色=([^<]+)/);
|
||||
if (debugMatch) {
|
||||
console.log('📋 調試信息:', {
|
||||
用戶: debugMatch[1],
|
||||
角色: debugMatch[2]
|
||||
});
|
||||
}
|
||||
} else if (pageContent.includes('儀表板') || pageContent.includes('管理員')) {
|
||||
console.log('✅ 管理員頁面正常顯示');
|
||||
} else {
|
||||
console.log('⚠️ 頁面內容不確定');
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('❌ 管理員頁面載入失敗:', response.status);
|
||||
}
|
||||
|
||||
console.log('\n🎉 管理員存取修復測試完成!');
|
||||
console.log('\n📋 修復內容:');
|
||||
console.log('✅ 添加了 isInitialized 狀態管理');
|
||||
console.log('✅ 改進了載入狀態檢查');
|
||||
console.log('✅ 修復了服務器端渲染問題');
|
||||
console.log('✅ 添加了調試信息顯示');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 測試過程中發生錯誤:', error);
|
||||
}
|
||||
}
|
||||
|
||||
testAdminFix();
|
Reference in New Issue
Block a user