fix: API URL 하드코딩 문제 해결 및 API 통합 개선
- API URL 생성 로직에서 localhost 환경 감지 개선 - 모든 페이지에서 하드코딩된 API URL 제거 - ManagementAPI, InboxAPI 추가로 API 호출 통합 - ProjectsAPI 사용으로 프로젝트 로드 통일 - permissions.js에서 API URL 동적 생성 적용
This commit is contained in:
@@ -323,20 +323,16 @@
|
||||
// 데이터 로드 함수들
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const apiUrl = window.API_BASE_URL || 'http://localhost:16080/api';
|
||||
const response = await fetch(`${apiUrl}/projects/`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
const apiUrl = window.API_BASE_URL || (() => {
|
||||
const hostname = window.location.hostname;
|
||||
if (hostname === 'm.hyungi.net') {
|
||||
return 'https://m-api.hyungi.net/api';
|
||||
}
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
projects = await response.json();
|
||||
updateProjectFilter();
|
||||
} else {
|
||||
throw new Error('프로젝트 목록을 불러올 수 없습니다.');
|
||||
}
|
||||
return '/api';
|
||||
})();
|
||||
// ProjectsAPI 사용
|
||||
projects = await ProjectsAPI.getAll(false);
|
||||
updateProjectFilter();
|
||||
} catch (error) {
|
||||
console.error('프로젝트 로드 실패:', error);
|
||||
}
|
||||
@@ -344,21 +340,18 @@
|
||||
|
||||
async function loadInProgressIssues() {
|
||||
try {
|
||||
const response = await fetch('/api/issues/admin/all', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
const apiUrl = window.API_BASE_URL || (() => {
|
||||
const hostname = window.location.hostname;
|
||||
if (hostname === 'm.hyungi.net') {
|
||||
return 'https://m-api.hyungi.net/api';
|
||||
}
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const allData = await response.json();
|
||||
// 진행 중 상태만 필터링
|
||||
allIssues = allData.filter(issue => issue.review_status === 'in_progress');
|
||||
filteredIssues = [...allIssues];
|
||||
} else {
|
||||
throw new Error('부적합 목록을 불러올 수 없습니다.');
|
||||
}
|
||||
return '/api';
|
||||
})();
|
||||
// ManagementAPI 사용하여 관리함 이슈 로드
|
||||
const managementData = await ManagementAPI.getAll();
|
||||
// 진행 중 상태만 필터링
|
||||
allIssues = managementData.filter(issue => issue.review_status === 'in_progress');
|
||||
filteredIssues = [...allIssues];
|
||||
} catch (error) {
|
||||
console.error('부적합 로드 실패:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user