api link to page

This commit is contained in:
2025-11-29 13:00:50 +09:00
parent 32e9fed5cd
commit 39d21a475b
11 changed files with 288 additions and 447 deletions

View File

@@ -1,3 +1,5 @@
import apiService from "@/app/lib/apiService";
type RoleType = 'learner' | 'instructor' | 'admin';
type AccountStatus = 'active' | 'inactive';
@@ -22,43 +24,8 @@ export async function getInstructors(): Promise<UserRow[]> {
?.split('=')[1])
: null;
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL
? `${process.env.NEXT_PUBLIC_API_BASE_URL}/admin/users/compact`
: 'https://hrdi.coconutmeet.net/admin/users/compact';
// 쿼리 파라미터 추가: type=ADMIN, limit=10
const apiUrl = new URL(baseUrl);
apiUrl.searchParams.set('type', 'ADMIN');
apiUrl.searchParams.set('limit', '10');
console.log('🔍 [getInstructors] API 호출 정보:', {
url: apiUrl.toString(),
hasToken: !!token,
tokenLength: token?.length || 0
});
const response = await fetch(apiUrl.toString(), {
method: 'GET',
headers: {
'Content-Type': 'application/json',
...(token && { Authorization: `Bearer ${token}` }),
},
});
console.log('📡 [getInstructors] API 응답 상태:', {
status: response.status,
statusText: response.statusText,
ok: response.ok
});
if (!response.ok) {
const errorText = await response.text();
console.error('❌ [getInstructors] API 에러 응답:', errorText);
console.error('강사 목록 가져오기 실패:', response.status);
return [];
}
const data = await response.json();
const response = await apiService.getUsersCompact();
const data = response.data;
console.log('📦 [getInstructors] 원본 API 응답 데이터:', {
type: typeof data,