fix: API URL 하드코딩 문제 해결 및 API 통합 개선

- API URL 생성 로직에서 localhost 환경 감지 개선
- 모든 페이지에서 하드코딩된 API URL 제거
- ManagementAPI, InboxAPI 추가로 API 호출 통합
- ProjectsAPI 사용으로 프로젝트 로드 통일
- permissions.js에서 API URL 동적 생성 적용
This commit is contained in:
hyungi
2025-11-08 15:34:37 +09:00
parent 637b690eda
commit 1299ac261c
6 changed files with 111 additions and 118 deletions

View File

@@ -46,7 +46,13 @@ class PagePermissionManager {
try {
// API에서 사용자별 페이지 권한 가져오기
const apiUrl = window.API_BASE_URL || 'http://localhost:16080/api';
const apiUrl = window.API_BASE_URL || (() => {
const hostname = window.location.hostname;
if (hostname === 'm.hyungi.net') {
return 'https://m-api.hyungi.net/api';
}
return '/api';
})();
const response = await fetch(`${apiUrl}/users/${this.currentUser.id}/page-permissions`, {
headers: {
'Authorization': `Bearer ${localStorage.getItem('access_token')}`